Importing JSON schema files
JSON schema files define JSON data structure and validate JSON data contents in a JSON document. When you use JSON schema files to check JSON contents in HTTP requests, FortiWeb can determine acceptable content and validate that the content is well-formed.
To configure FortiWeb to enforce JSON schema files, create a JSON protection rule and select JSON schema for that rule. You can select a single JSON schema file or a schema file group for each JSON protection rule.
This section provides instructions to:
- Import a JSON schema file
- Create a JSON schema file group
- Select JSON schema file or group in a JSON protection rule
To import a JSON schema file
- Go to API Protection > JSON Protection.
- Select the JSON Schema tab.
- Click Create New.
- Enter a name for the JSON schema file.
- For Upload File, click Choose File.
- Select an acceptable JSON schema file.
- Select a JSON schema version. The system will check if schema file is valid against the specified version. If your select Auto-Identify, FortiWeb will use the version stated by the ‘$schema’ key in the JSON Schema file. If ‘$schema’ is not found or incorrect, then all versions will be checked.
- Click OK.
Please use a JSON validation tool to verify the JSON schema file before uploading it to FortiWeb. It's recommended to use this one: HTTPS://www.jsonschemavalidator.net/. |
To Create a JSON schema file group
You can group multiple JSON Schemas together and reference the group in a JSON Protection Rule. If a request does not match any of the schema in the group it will be considered as a violation.
- Go to API Protection > JSON Protection.
- Select the JSON Schema Group tab.
- Click Create New.
- Enter a name for the JSON schema group.
- Click OK.
- Click Create New to add a JSON schema file to this group.
- In the New Schema Group Member window, select a JSON Schema you have created.
- Click OK.
- Repeat step 6 to 9 to add more JSON schema files to this group.
To select a JSON schema file or group in a JSON protection rule
For details about creating a JSON protection rule, see Creating JSON protection rules.
- Go to API Protection > JSON Protection.
- Select the JSON Protection Rule tab.
- Select an existing JSON protection rule to which you want to add the JSON schema file.
- For Schema type, select Single Schema or Schema Group, then choose the schema file or group from the drop down menu.
- Click OK.