Stranger6667/jsonschema-rs

OneOfNotValid having uninformative description?

Closed this issue · 0 comments

I might not understand the point of "oneOf", but if it means "this field must work under one of the following schemas", then would it be very helpful to actually name the field the properties of which must follow the schemas. I bumped into this problem when a toml validator extension that uses this crate in its source code produced this unhelpful error validating a pyproject.toml:
image

What seems to be happening is that "project" has a "oneOf" in it, which requires either "version" or "dynamic" field.
Hence, i think it would be helpful to have, instead of

{"name":"hello"} is not valid under any of the given schemas

something among the lines of

{"name":"hello"} is not valid under any of the schemas given in the "oneOf" option list

In case you think it is obvious that "any of the given schemas" refers specifically to "oneOf", i'm happy to inform that there is a half a year old issue about this error message :)

just for the sake of reproducibility, the full pyproject.toml im referring to looks like this:

[project]
name = 'hello'
# version = "2.0.0"v # commented out to show the point