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
The const keyword was added in draft-06, and therefore has no effect whatsoever in draft-04 schemas. While authors probably intended to constrain the value somewhat, we still have to follow the spec!
By coincidence, the very same behavior happened to me yesterday - I was canonicalising the Swagger schema (where $schema points to draft04) components and my test suite started failing when single-item enums were transformed to const :) Probably having a condition on the draft version should be sufficient to fix it
The
const
keyword was added in draft-06, and therefore has no effect whatsoever in draft-04 schemas. While authors probably intended to constrain the value somewhat, we still have to follow the spec!See also python-jsonschema/jsonschema#778; longer term this is another argument for my do-it-right schema processing redesign...
The text was updated successfully, but these errors were encountered: