The idea is that with @type and enum I indicate which type to validate against.
The problem I have is that if there's any error, say, I set name to a number, I get oneOf validation error like:
The property '#/persons/5' of type object did not match any of the required schemas
This is normal, as the data did not match a oneOf, but it's not helpful for determining the error.
I'd be happy to use a completely different approach, but I could not think of any.
So as a quick solution, would it make sense to show the data in the validation error, to at least see what went wrong? Something like:
The property '#/persons/5' of type object did not match any of the required schemas:
{
"@type": "admin",
"name": 42
}
Hi guys, I've checked the issues and couldn't find anything similar. I am trying to implement a multitype array with json schema.
The idea is that with
@type
andenum
I indicate which type to validate against.The problem I have is that if there's any error, say, I set
name
to anumber
, I getoneOf
validation error like:This is normal, as the data did not match a
oneOf
, but it's not helpful for determining the error. I'd be happy to use a completely different approach, but I could not think of any.So as a quick solution, would it make sense to show the data in the validation error, to at least see what went wrong? Something like:
Thanks!