How to create a constraint based on the number of objects in an array with a specific value of one of the properties? #706
-
I'm trying to write a schema that will only pass JSON that has one and only one object of a certain type in an array, regardless of the types of the other objects in that array. I'll appreciate any help. The "root" object contains an array of objects. Objects in an array have a On the list should be:
The position (index) of the "answer" object on the list is arbitrary. Valid JSONs
Invalid JSONs:
I wrote a schema like this:
For validation I use "JSON Schema Validation CLI" (version 3.2.0). Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Your valids and invalids all check out against that schema on my https://json-everything.net. Your schema looks right to me. I'd file a bug on the validator you're using. |
Beta Was this translation helpful? Give feedback.
Your valids and invalids all check out against that schema on my https://json-everything.net. Your schema looks right to me. I'd file a bug on the validator you're using.