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
We have come across the following use case/bug a couple of times recently in the HCA metadata:
During schema edits, properties were removed or renamed but the update was not propagated to the required array. We therefore had properties declared as required that were not defined under properties{}.
These schemas were not flagged as invalid but as all our schemas use additionalProperties:false, no document can be successfully validated against such a schema as it would either be missing a required property or contain an undefined additional property.
We think this logical contradiction should be accounted for in the JSON Schema specification.
The text was updated successfully, but these errors were encountered:
This is the sort of thing that should be caught by a linter, rather than forbidden by the specification. The specification allows for many nonsensical/impossible keyword combinations to exist for a variety of reasons, including that sometimes auto-generated schemas correctly produce such combinations where the desired outcome is that nothing validates.
I'm going to close this issue in favor of #681 but please do add your use case there.
@daniwelter it should also be mentioned that it's okay to say that a property is required without explicitly defining it. I would say, however, that an author SHOULD list the property with a true requirement that would make any value valid, just to be explicit.
If you or your company has a policy that all properties should be listed, then I agree with @handrews: use a linter.
We have come across the following use case/bug a couple of times recently in the HCA metadata:
During schema edits, properties were removed or renamed but the update was not propagated to the
required
array. We therefore had properties declared asrequired
that were not defined underproperties{}
.These schemas were not flagged as invalid but as all our schemas use
additionalProperties:false
, no document can be successfully validated against such a schema as it would either be missing a required property or contain an undefined additional property.We think this logical contradiction should be accounted for in the JSON Schema specification.
The text was updated successfully, but these errors were encountered: