Altova XMLSpy 2024 Enterprise Edition

Conditionals are a new feature in draft-07. They enable you to specify that validation restrictions are to be different depending on certain aspects of the object, such as its type and/or additional type specific restrictions.

 

Adding a conditional

You can add a conditional to any definition via the definition's context menu (see screenshot below). To access the conditional's sub-menu, right-click the definition to which you wish to add the conditional, and then select Add Child | Conditional.

JSONSchemaAddConditional

 

Setting up conditional validation

The conditional is added as a box with three elements: If-Then-Else (see screenshot below).

JSONSchemaConditional

To set up conditional validation do the following:

 

1.Set up the condition in the If box by first selecting a type in the Details entry helper and then a type-based constraint in the Constraints entry helper.

2.In the Then box, set up the validation requirements in the event that the condition (specified in the If box) is fulfilled.

3.In the Else box, set up the validation requirements in the event that the condition (specified in the If box) is not fulfilled.

 

 

 

© 2017-2023 Altova GmbH