On this page, create a list of your custom JSON schemas in addition to the system schemas provided by WebStorm and configure the scope for each schema, 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.
On this page:
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, WebStorm 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.
- To add a schema to the list, click on the toolbar of the pane and select the relevant schema file under the project root in the dialog box that opens.
- 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 right-hand pane of the page.
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
.json file that implements it, 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, WebStorm searches for files and folders with the specified names and the search is restricted to the the current project.
Based on the list, WebStorm 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. WebStorm analyzes scopes in two modes:
- Static Analysis detects conflicts in scopes of custom schemas. If a conflict is detected, WebStorm displays a warning in the Schema Details pane. To view the overlapping scopes, click the Show details link. WebStorm 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, WebStorm displays a warning at the top of the editor tab: Click the link to open the JSON Schema page and edit the scope of the conflicting custom schema. Note that you cannot edit the scope of system schemas.