jpmckinney / validictory

🎓 deprecated general purpose python data validator
Other
240 stars 57 forks source link

Proposal: Support of minProperties and maxProperties #45

Closed marcmolla closed 10 years ago

marcmolla commented 11 years ago

The json schema proposal includes two validations for the properties: minProperties and maxProperties. Using these validations we could define an object with several optional properties and, for example, define that it could have only one property.

A example of use is:

schema = {"type": "object", "properties": { "a": {"type":...}, "b": {"type":...}, "minProperties" = 1, "maxProperties" = 1}}

valid: {"a": ...} {"b": ...}

Invalid: {} {"a": ..., "b":...}

jamesturk commented 11 years ago

until the mess that is json-schema calms down i'm not interested in implementing more of these features, if you have a need though feel free to submit a pull request with tests