Schema validation for mixed array type #2781
Unanswered
supercoffee
asked this question in
Q&A
Replies: 1 comment 2 replies
See you |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to figure out the correct way to validate an array that can contain mixed object types while also validating that each of the objects matches a valid schema. I've been able to pull off mixed type validation with single properties, but this array is throwing me off.
Example data. The last element in the array should not pass validation, but the first two should match the
ObjectWithIdandUserWithEmailschema respectively.[ { "_id": "asdf12345" }, { "email": "user@example.com" }, { "invalid": "invalid" } ]Example schema
I've tried all kinds of variations of
items/anyOf/oneOfbut nothing generates a schema other than{ "properties": { "notify" : { "type": "array" } } }All reactions