You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using additionalProperties seems to omit acceptance of declared properties when those properties are declared in a definitions section
Expected behavior
The additionalProperties setting should not behave differently depending on whether properties are declared in a definitions section
Actual behavior
The additionalProperties setting behaves differently depending on whether properties are declared in a definitions section
In the example below, the schema that avoids the use of definitions behaves as expected when additionalProperties == false
In the example below, the schema that uses definitions behaves unexpectedly additionalProperties == false ... the error message is Additional properties are not allowed
Example
Sample schema (avoiding use of definitions and YAML-formatted)
# ## ********************
## NO__WORKY -- age must be integer
-
fname: homer
lname: himpson
age: '33'
## ********************
## NO__WORKY -- age is required
-
fname: homer
lname: himpson
## ********************
## YES_WORKY -- all expected properties
-
fname: homer
lname: himpson
age: 33
## ********************
## additional property 'motto' (affected by additionalProperties)
-
fname: homer
lname: himpson
age: 33
motto: i love science
The text was updated successfully, but these errors were encountered:
This is the behavior specified by the spec for better or worse.
Many run into this same issue, which I believe is being addressed in part in draft 8, but yeah, nothing really here for this library to do at the minute.
Got it. Thanks for the heads-up. Any references or links to the specification greatly appreciated, by anyone who may come across this issue, before it is closed.
@dreftymac you are looking for draft-08's unevaluatedProperties: json-schema-org/json-schema-spec#656 (although note that there were several other changes laying the groundwork for how that keywords functions, as it's much more complicated than you'd think to make this work).
Problem
additionalProperties
seems to omit acceptance of declared properties when those properties are declared in adefinitions
sectionExpected behavior
additionalProperties
setting should not behave differently depending on whether properties are declared in adefinitions
sectionActual behavior
additionalProperties
setting behaves differently depending on whether properties are declared in adefinitions
sectiondefinitions
behaves as expected whenadditionalProperties
== falsedefinitions
behaves unexpectedlyadditionalProperties
== false ... the error message isAdditional properties are not allowed
Example
Sample schema (avoiding use of definitions and YAML-formatted)
Sample schema (using definitions and YAML-formatted)
Sample documents
The text was updated successfully, but these errors were encountered: