JSON Schema Mappings
On this page, create a list of your custom JSON schemas in addition to the system schemas provided by CLion. For each schema, configure its scope, that is, specify the
.json files to be validated against it. The page consists of two panes: the List of Schemas pane and the Schema Details pane.
List of Schemas Pane
The central pane of the page shows a list of custom JSON schemas against which
.json files in the current project will be validated. Based on a schema, CLion checks the structure of
.json configuration files, reports errors (for example, informs you about missing mandatory properties), provides code completion and documentation look-up.
The pane shows only custom schemas that you have previously downloaded or created yourself, in either case, a custom schema must meet the JSON schema standards and must be located under the project root.
System schemas that CLion provides for all supported frameworks and technologies are not shown in the list.
- To add a schema to the list, click on the toolbar and configure the schema in the Schema Details pane.
- To remove a schema from the list, select it and click on the toolbar of the pane.
- To configure the scope of a schema, select the schema and specify the files to be validated against it in the Schema Details pane.
Schema Details Pane
The pane shows the details of the schema selected in the List of Schemas pane: the name of the selected schema, the local
.json file that implements it or the URl address of such file, the version of the Schema Specification with which your Schema complies, and a list of files and folders that are validated against the schema.
The list contains the names of specific files, the names of entire directories, and filename patterns. You do not need to specify full paths to files and folders, CLion searches for files and folders with the specified names and the search is restricted to the current project. Based on the list, CLion internally creates a list of files to be validated. Each file is included in the list only once: if a file with the specified name is stored in a directory from the list or its name matches a pattern, the file is still validated only once.
- To add new files or folders to the list, click on the toolbar of the pane and specify the file, folder, or a file pattern in the Add JSON Schema Mapping Dialog that opens.
- To remove an item from the list, select it and click on the toolbar of the pane.
Handling Conflicts Among Scopes of Schemas
A conflict arises when a file, or a folder, or a pattern belongs to the scopes of two or more schemas. CLion analyzes scopes in two modes:
- Static Analysis detects conflicts in scopes of custom schemas. If a conflict is detected, CLion displays a warning in the Schema Details pane. To view the overlapping scopes, click the Show details link. CLion shows a pop-up message where the conflicting scopes and schemas are listed:
- Dynamic Analysis detects conflicts in scopes of both system and custom schemas. This type of analysis is started when you open a file that belongs to a certain scope. If a conflict is detected, CLion displays a warning at the top of the editor tab: Click the link to open the JSON Schema Mappings page and edit the scope of the conflicting custom schema. Note that you cannot edit the scope of system schemas.