Skip to content

Different types of properties behavior in schemas with allOf #3103

Closed Answered by flaksp
mtovt asked this question in Q&A
Discussion options

You must be logged in to vote

The Bar schema is valid. But it won't work as you expect.

Schema instance (a value you are validating against a schema) is valid only when it was successfully validated agains all keywords in a schema.

Let's say this is a value you are validating against Bar schema:

{
  "property1": []
}

This is how validator will validate the value against your schemas:

  • Evaluating /components/schemas/Bar/type keyword: is passed value has type object? Yes.
  • Evaluating /components/schemas/Bar/properties:
    • Evaluating /components/schemas/Bar/properties/property1/type keyword: is passed value has type array? Yes.
  • Evaluating /components/schemas/Bar/allOf keyword:
    1. Evaluating /components/schemas/Bar/allOf/0/$ref

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mtovt
Comment options

You must be logged in to vote
1 reply
@flaksp
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants