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
When using a schema that has some default values for properties, the validation
passes when those properties are missing.
That's completely fine, but I'd expect also that when a property is missing,
the data passed to the validator is overwritten to set the property to the
default value according to the schema.
I realize that if the schema type doesn't match a mutable type, this won't work
because the jsonschema.validate won't be able to modify the data in place. In such a
case, maybe a change in the API so that it returns the new data would be fine:
This is a duplicate of #4, you can check that out for one or two examples of some code that does this. The JSON Schema specification doesn't specify that the default property should do this, and by default, IMHO, it shouldn't :). Since it's relatively easy to do this yourself (see there), I think that should be good. Let me know if that works for you.
When using a schema that has some default values for properties, the validation
passes when those properties are missing.
That's completely fine, but I'd expect also that when a property is missing,
the data passed to the validator is overwritten to set the property to the
default value according to the schema.
For example:
What I'd expect is:
I realize that if the schema type doesn't match a mutable type, this won't work
because the
jsonschema.validate
won't be able to modify the data in place. In such acase, maybe a change in the API so that it returns the new data would be fine:
The text was updated successfully, but these errors were encountered: