The Definitions Overview Grid in the main window (screenshot below) displays a list of the schema's global definitions. These global definitions are: (i) the main document schema definition, (ii) definitions of global JSON types, such as objects, arrays, strings, etc, that are JSON Schema types; (iii) definitions of external or custom defined JSON types; currently only definitions that occur within a container named resourceDefinitions is available; this is the container used by Microsoft's Azure Resource Manager for JSON definitions. Add a new resourceDefinitions section to the schema document via the Append Definitions Section or Insert Definitions Section icon in the grid's toolbar (see screenshot below).
Defining a JSON type globally is useful if that type needs to be reused within the same schema or in another schema. For example, you can define a JSON string type for US telephone numbers in one JSON schema—say, a library of such definitions—and then reference this definition from within the same schema as well as from other JSON schemas.
Adding a definition, and related actions
The following actions are available for adding and editing definitions in the Definitions Overview Grid.
|•||To add a definition: Click the Append Named Schema Definition or Insert Named Schema Definition icon at the top left of the Definitions Overview Grid (see screenshot above). A new empty definition will be created in the grid; it will have a default name. The new definition will also be listed in the Overview entry helper as a Def (see screenshot above).|
|•||To change the type of a definition: Every new definition is created with a type of Any. You can change its type in the Details entry helper (see screenshot below, where the type is 'String') or by editing the definition in Design View.|
|•||To rename a definition: Double-click its name and edit the name. Alternatively, edit the Name field in the Details entry helper.|
|•||To enter a description of the definition: Edit the Description field in the Details entry helper. The description appears in the Definitions Overview Grid next to the name of the definition (see screenshot below). You can also double-click in the Description field of Definitions Overview Grid to edit a description.|
|•||To reference a definition: See the description of the Overview entry helper and the section Global and Local Definitions.|
|•||To edit a definition: Click the definition's icon in the Definitions Overview Grid or double-click the definition in the Overview entry helper. This opens the definition in Design View, where it can be edited.|
© 2019 Altova GmbH