This is an example to show that jsonschema-rs
(Python
) does not return nested errors when a field in oneOf
is not matching the correct type.
However, AJV
(Javascript
) returns the nested errors.
poetry
yarn
jsonschema-rs
(Python
)
poetry install
poetry shell
python main.py
AJV
(Javascript
)
yarn
yarn index
/oneOf-ex$ yarn index
Error for single schema: /properties/id must be string
Error for dual schema: /properties/id must be string
Error for dual schema: /category must be equal to constant
Error for dual schema: must match exactly one schema in oneOf
Error for dual conditional schema: /properties/id must be string
/oneOf-ex$ python main.py
Error for single schema: 1234 is not of type "string"
Error for dual schema: {"category":"CatA","properties":{"id":1234}} is not valid under any of the given schemas
Error for dual conditional schema: 1234 is not of type "string"