We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice to have support for the discriminator object so that anyOf or oneOf schemas can return good validation errors.
anyOf
oneOf
Exemple schema:
{ "$ref": "#/$defs/Route", "$defs": { "MountainHiking": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["mountain_hiking"] }, "length": { "type": "integer", } }, "required": ["discipline", "length"] }, "AlpineClimbing": { "type": "object", "properties": { "discipline": { "type": "string", "enum": ["alpine_climbing"] }, "height": { "type": "integer", }, }, "required": ["discipline", "height"] }, "Route": { "discriminator": { "propertyName": "discipline", "mapping": { "mountain_hiking": {"$ref": "#/$defs/MountainHiking"}, "alpine_climbing": {"$ref": "#/$defs/AlpineClimbing"}, } }, "oneOf": [ {"$ref": "#/$defs/MountainHiking"}, {"$ref": "#/$defs/AlpineClimbing"}, ] } } }
Example instance:
{ "discipline": "mountain_hiking", "length": "bad_string" }
Current error:
....is not valid under any of the given schemas...
Expected error:
...'bad_string' is not of type integer...
The text was updated successfully, but these errors were encountered:
Fixed with #30.
Sorry, something went wrong.
No branches or pull requests
It would be nice to have support for the discriminator object so that
anyOf
oroneOf
schemas can return good validation errors.Exemple schema:
Example instance:
Current error:
Expected error:
The text was updated successfully, but these errors were encountered: