json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Conditional required rule #981

Closed kris2214 closed 6 years ago

kris2214 commented 6 years ago

Consider I have a json schema as below: .... { "properties" : { "minimumDelay" : { "type" : "number" }, "length" : { "type" : "number" }, }, "required": { "minimumDelay", "length" }

Here the json data will be valid if I enter both minimumDelay and length values.

But my requirement is json data must be valid when I enter either 1 of the values(like XOR case). How my schema must be modified to achieve the same?

Anthropic commented 6 years ago

This would be handled with oneOf validation which isn't currently supported without making a basic add-on to provide it.