Skip to content

additionalProperties: false and anyOf/allOf #821

Answered by jviotti
rafalkrupinski asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rafalkrupinski ,

In your example, it should not. additionalProperties only considers a properties keyword that is a direct sibling of it, ignoring any other one. However, in 2019-09 and later, we introduced unevaluatedProperties (https://www.learnjsonschema.com/2020-12/unevaluated/unevaluatedproperties/) for that specific reason: it can look at adjacent properties that are not direct siblings.

For example:

type: object
properties: []
unevaluatedProperties: false
allOf:
- properties:
  - key
    type: string

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@rafalkrupinski
Comment options

@jviotti
Comment options

jviotti Nov 4, 2024
Collaborator

@rafalkrupinski
Comment options

Answer selected by rafalkrupinski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants