You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Property 'foo' has not been defined and the schema does not allow additional properties.
or this in vscode:
Property foo is not allowed.
If you turn off #[schemars(deny_unknown_fields)] for the inner struct, Baz, then the schema passes - however this also means that ofc you can add extra properties -- which is sub-optimal.
If you also add #[schemars(deny_unknown_fields)] to the enums then you end up with even worse errors because the bar and prop fields aren't declared on the outer object - so they also error.
The issue is that from what I can tell validators do not "correctly" consider additionalProperties within nested oneOfs.
I don't know the best path forward here. I can see that if we were to flatten the nested definitions down into a single-level of oneOf then it will work as expected -- but I suspect this would be quite a complicated thing to do.
The text was updated successfully, but these errors were encountered:
I have the following enums:
And it generates the following JSON schema
For example attempting to validate this object:
Leads to an error like this in tools like jsonschemavalidator
or this in vscode:
If you turn off
#[schemars(deny_unknown_fields)]
for the inner struct,Baz
, then the schema passes - however this also means that ofc you can add extra properties -- which is sub-optimal.If you also add
#[schemars(deny_unknown_fields)]
to the enums then you end up with even worse errors because thebar
andprop
fields aren't declared on the outer object - so they also error.The issue is that from what I can tell validators do not "correctly" consider
additionalProperties
within nestedoneOf
s.I don't know the best path forward here. I can see that if we were to flatten the nested definitions down into a single-level of
oneOf
then it will work as expected -- but I suspect this would be quite a complicated thing to do.The text was updated successfully, but these errors were encountered: