Associating a JSON Schema Directly in YAML Documents
Associate Schema Action
The schema used by the validation engine can be associated with the current document by using the Associate Schema action. The association can specify a relative file path or a URL of the schema.
To associate a JSON Schema to the current YAML document, follow these
steps:
-
Select the Associate Schema action from the toolbar (or menu).
Step Result: The Associate Schema dialog box is displayed:
This dialog box contains the following options for YAML documents:- URL - Allows you to specify or select a URL for the schema. It also keeps a history of the last used schemas. The URL must point to the schema file that can be loaded from the local disk or from a remote server through HTTP(S), FTP(S) or a custom protocol.
- Use path relative to file location - Select this option if the YAML instance document and the associated schema contain relative paths. The location of the schema file is inserted in the YAML instance document as a relative file path. This practice allows you, for example, to share these documents with other users without running into problems caused by multiple project locations on physical disk.
- Select the JSON Schema that will be associated with the YAML document.
- Click OK.
Result: A $schema
property is added at the beginning of the
document with its value set to the specified URL. If the document already contained a schema
association, the old association will be replaced with the new one.
Tip: To quickly open the schema used for validating the
current document, select the Open Associated Schema action from the toolbar (or
menu).