json-schema-org / json-schema-spec

The JSON Schema specification
http://json-schema.org/
Other
3.82k stars 266 forks source link

Ignore unknown keywords or treat as annotations #1269

Closed handrews closed 2 years ago

handrews commented 2 years ago

This is just a bug fix for an accidental oversight. I'm hoping it's non-controversial as I don't think any of us meant to allow arbitrary behaviors for unrecognized keywords.

When we added the "SHOULD collect as annotations" behavior for unknown keywords, we forgot to retain the MUST directive to ignore them if the SHOULD is not followed. Which also ensures that no other behavior than collecting as a annotations is performed.

This also consolidates the behavioral specification in one place as it appeared in two places before.