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
If minProperties is greater than or equal to the number of declared properties and additionalProperties is false, all properties should be required
#565
Open
andreww2012 opened this issue
Dec 25, 2023
· 2 comments
What is the usecase? "minProperties" is used for various types of hash tables or when only a subset of any properties listed is required (in which case all properties are optional as far as types concerned). The example above can be expressed as declaring "required" array and it will result in a more readable schema and most likely more performant validation function.
It (kind of) prevents fields duplication problem if all fields are required (I wish JSON schema had an easy and safe way to express this). Kind of, because if new ones are added, one may still forget to update minProperties.
And, well, technically the current behaviour is incorrect.
Hello, I think the following schema should produce the object type with all the properties required:
The current output:
The expected output:
The text was updated successfully, but these errors were encountered: