Altova XMLSpy 2024 Enterprise Edition

There are four operators: (i) allOf, (ii) anyOf, (iii) oneOf, and (iv) not. Operators are used to specify conditions of validity as explained below. You can add an operator to any definition. To access the operator sub-menu, right-click the definition to which you wish to add an operator, and then select Add Child | Operator (see screenshot below).

JSONDVContextMenuExp01

These operators specify conditions for successful validation, as follows:

 

Operator

Icon

Description

JSONAllOfIcon

All Of

Contains one or more sub-schemas (definitions), added as children of the operator. An instance is valid if it is valid against all these sub-schemas.

JSONAnyOfIcon

Any Of

Contains one or more sub-schemas (definitions), added as children of the operator. An instance is valid if it is valid against at least one of these sub-schemas.

JSONOneOf

One Of

Contains one or more sub-schemas (definitions), added as children of the operator. An instance is valid if it is valid against exactly one of  these sub-schemas.

JSONNotIcon

Not

Contains exactly one sub-schema (definition), added as a child of the operator. An instance is valid if it is invalid against the given definition.

 

The screenshot below shows a One Of operator that contains three child sub-schemas (definitions). For the instance to be valid, it must have one JSON data structure (at this point in the document structure) that matches one of the three sub-schema definitions.

JSONOneOfExample

Operators can be useful for specifying inheritance and restriction. The screenshot below, for example, shows how to use the All Of operator to define an array containing non-empty unique strings.

JSONAllOfExample

 

© 2017-2023 Altova GmbH