Skip to content

Apply discriminator before unevaluated keywords#220

Merged
davishmcclurg merged 1 commit into
mainfrom
discriminator-unevaluated
Jun 19, 2025
Merged

Apply discriminator before unevaluated keywords#220
davishmcclurg merged 1 commit into
mainfrom
discriminator-unevaluated

Conversation

@davishmcclurg

Copy link
Copy Markdown
Owner

discriminator needs to run before unevaluatedProperties so that the correct list of unevaluated properties can be collected. From the spec:

This means that "properties", "patternProperties", "additionalProperties", and all in-place applicators MUST be evaluated before this keyword can be evaluated.

discriminator is an "in-place applicator" in this case, because it replaces allOf/anyOf/oneOf.

Fixes: #217

`discriminator` needs to run before `unevaluatedProperties` so that the
correct list of unevaluated properties can be collected. From the
[spec][0]:

> This means that "properties", "patternProperties", "additionalProperties", and all in-place applicators MUST be evaluated before this keyword can be evaluated.

`discriminator` is an "in-place applicator" in this case, because it
replaces allOf/anyOf/oneOf.

Fixes: #217

[0]: https://json-schema.org/draft/2020-12/json-schema-core#section-11.3
@davishmcclurg davishmcclurg merged commit b39c297 into main Jun 19, 2025
58 checks passed
@davishmcclurg davishmcclurg deleted the discriminator-unevaluated branch June 19, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive with nested discriminator and unevaluatedProperties

1 participant