Fortinet white logo
Fortinet white logo

Administration Guide

Importing JSON schema files

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
  1. Go to API Protection > JSON Protection.
  2. Select the JSON Schema tab.
  3. Click Create New.
  4. Enter a name for the JSON schema file.
  5. For Upload File, click Choose File.
  6. Select an acceptable JSON schema file.
  7. 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.
  8. 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.

  1. Go to API Protection > JSON Protection.
  2. Select the JSON Schema Group tab.
  3. Click Create New.
  4. Enter a name for the JSON schema group.
  5. Click OK.
  6. Click Create New to add a JSON schema file to this group.
  7. In the New Schema Group Member window, select a JSON Schema you have created.
  8. Click OK.
  9. 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.

  1. Go to API Protection > JSON Protection.
  2. Select the JSON Protection Rule tab.
  3. Select an existing JSON protection rule to which you want to add the JSON schema file.
  4. For Schema type, select Single Schema or Schema Group, then choose the schema file or group from the drop down menu.
  5. Click OK.

Importing JSON schema files

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
  1. Go to API Protection > JSON Protection.
  2. Select the JSON Schema tab.
  3. Click Create New.
  4. Enter a name for the JSON schema file.
  5. For Upload File, click Choose File.
  6. Select an acceptable JSON schema file.
  7. 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.
  8. 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.

  1. Go to API Protection > JSON Protection.
  2. Select the JSON Schema Group tab.
  3. Click Create New.
  4. Enter a name for the JSON schema group.
  5. Click OK.
  6. Click Create New to add a JSON schema file to this group.
  7. In the New Schema Group Member window, select a JSON Schema you have created.
  8. Click OK.
  9. 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.

  1. Go to API Protection > JSON Protection.
  2. Select the JSON Protection Rule tab.
  3. Select an existing JSON protection rule to which you want to add the JSON schema file.
  4. For Schema type, select Single Schema or Schema Group, then choose the schema file or group from the drop down menu.
  5. Click OK.