networknt / json-schema-validator

A fast Java JSON schema validator that supports draft V4, V6, V7, V2019-09 and V2020-12
Apache License 2.0
822 stars 323 forks source link

Too many errors reported when the "unevaluatedProperties" property is used #962

Closed slafon51 closed 7 months ago

slafon51 commented 7 months ago

Hello,

Since version 1.3.1, too many errors are reported when the "unevaluatedProperties" property is used.

With the schema :

{
  "type": "object",
  "required": [
    "key1"
  ],
  "properties": {
    "key1": {
      "type": "string"
    },
    "key2": {
      "type": "string"
    },
    "key3": {
      "type": "string"
    }
  },
  "unevaluatedProperties": false
}

and the data :

{
    "key2": "value2",
    "key3": "value3",
    "key4": "value4"
}

The version 1.3.0 returns the following errors, which are correct:

$: required property 'key1' not found
$.key4: must not have unevaluated properties

But the version 1.3.1 returns :

$: required property 'key1' not found
$.key2: must not have unevaluated properties
$.key3: must not have unevaluated properties
$.key4: must not have unevaluated properties

and the version 1.3.2 returns the same errors :

$: required property 'key1' not found
$: property 'key2' must not be unevaluated
$: property 'key3' must not be unevaluated
$: property 'key4' must not be unevaluated

Best regards.