You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Radu Almășan (Jira)" <ji...@apache.org> on 2021/12/15 19:39:00 UTC

[jira] [Updated] (JOHNZON-356) patternProeprties for nested properties

     [ https://issues.apache.org/jira/browse/JOHNZON-356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Almășan updated JOHNZON-356:
---------------------------------
    Description: 
When using {{patternProperties}} on nested properties it apparently gets ignored. For example for the following schema:
{code:java}
{
  "type": "object",
  "properties": {
    "nested": {
      "type": "object",
      "patternProperties": {
        "[0-9]+": {
          "type": "number"
        }
      }
    }
  }
}{code}
This JSON would appear valid:
{code:java}
{
  "nested": {
    "1": "foo"
  }
} {code}
I believe this is because the code isn't using the {{valueProvider}} to resolve the actual validable but is always defaulting to the root object.

I do not have access to push a branch and create a PR so I'm attaching the git patch to this issues with the proposed fix and test.

  was:
When using {{patternProperties}} on nested properties it apparently gets ignored. For example for the following schema:
{code:java}
{
  "type": "object",
  "properties": {
    "nested": {
      "type": "object",
      "patternProperties": {
        "[0-9]+": {
          "type": "number"
        }
      }
    }
  }
}{code}
This JSON would appear valid:
{code:java}
{
  "nested": {
    "1": "foo"
  }
} {code}
I believe this is because the code isn't using the {{valueProvider}} to resolve the actual validable but is always defaulting to the root object.

I do not have access to push a branch and create a PR so I'm attaching the git patch to this issues with the fix.


> patternProeprties for nested properties
> ---------------------------------------
>
>                 Key: JOHNZON-356
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-356
>             Project: Johnzon
>          Issue Type: Improvement
>            Reporter: Radu Almășan
>            Priority: Major
>              Labels: patch
>         Attachments: 0001-fix-using-patternProperties-in-nested-objects.patch
>
>
> When using {{patternProperties}} on nested properties it apparently gets ignored. For example for the following schema:
> {code:java}
> {
>   "type": "object",
>   "properties": {
>     "nested": {
>       "type": "object",
>       "patternProperties": {
>         "[0-9]+": {
>           "type": "number"
>         }
>       }
>     }
>   }
> }{code}
> This JSON would appear valid:
> {code:java}
> {
>   "nested": {
>     "1": "foo"
>   }
> } {code}
> I believe this is because the code isn't using the {{valueProvider}} to resolve the actual validable but is always defaulting to the root object.
> I do not have access to push a branch and create a PR so I'm attaching the git patch to this issues with the proposed fix and test.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)