Please enable JavaScript to view this site.

Altova XMLSpy 2022 Enterprise Edition

JSON schema definitions can be created globally or locally.

 

Global definitions are created in the Definitions Overview Grid of the main window by adding a definition and then specifying its properties. A global definition can be referenced by other definitions in the same schema or by definitions in other schemas. This enables the reuse of definitions across your project. All the global definitions of the current schema are displayed in the schema's Definitions Overview Grid. Global definitions from other schemas can be made available for reuse by adding the external schema in the Overview entry helper.

Local definitions are created within global definitions, that is, by adding descendant or sibling definitions to a global definition.

 

Referencing a global definition

To reference a global definition from within another definition, do one of the following:

 

In Design View, drag the global definition from the Overview entry helper onto the definition where it is to be used.

In Design View, right-click the definition for which you want to reference a global definition and select Edit Reference. (Alternatively, with the definition selected in Design View, go to its Details entry helper and click the Additional Dialog button of the Reference field.) In the Edit Reference dialog that appears (screenshot below), select the global reference you want to reference. Another way to access the Edit Reference dialog is to select the referencing definition, go to its Reference field in the Details entry helper, and click the fields Additional Dialog button of the select the global definition you want to reuse (see the description of the Details entry helper for details).

JSONSVAddReference

 

Note:A definition can (i) reference a global definition and not contain any local definition or local constraint, or (ii) both reference a global definition as well as contain local definitions/constraints (from draft-2019-09 onwards). In the latter case, the reference is known as an extended reference. In the Edit Reference dialog, you can create a reference to a global definition as an extended reference by checking the dialog's Extended reference check box. A global definition which is created as an extended reference is always displayed as the last item in the list of the referencing component's definitions. If a value exists for the referencing component's description keyword, then this value is displayed below the referencing component.

 

Note:If you change the name of a global definition after it has been referenced by another definition in the same schema, then the name is also changed in the reference. References from other schemas, however, will need to be edited manually to reflect the name change.

 

Converting local definitions to global definitions

To convert a local definition, right-click it in Design View and select Make Global. A global definition is created and a reference to it will be created on the local definition. Since the name of the global definition is generated automatically, you can edit it and the change will be passed to the reference of the local definition.

 

Changing a ref to a global definition into a local definition

A reference to a global definition can exist on both local and global definitions. To remove the reference and make its properties local, right-click the (local or global) definition in Design View and select Make Local. The global definition's properties are created locally on the definition.

 

© 2016-2022 Altova GmbH