JSON Schema Validation
JSON configs can be configured with a JSON Schema. When a schema is set, every value the config can return is validated against the schema before it is saved, so a value that does not pass validation never reaches your applications. This applies to targeting rules values (including the default rule), and experiment variations, whether they are changed from the dashboard, the Admin API, or Terraform.
JSON Schema Validation is available in all of our plans.
When values are validated
- When you add or update the schema, every existing value in every environment is validated against the new schema. The update is rejected if any environment holds a value that no longer validates.
- When you save targeting rules for an environment, every rule value is validated against the schema.
- When you update the variations of a JSON experiment, every variation is validated against the schema.
Schema support
Schemas are validated as JSON Schema draft-07. Regular expressions in pattern and patternProperties are analyzed before the schema is accepted, and a pattern that can take exponential time to match, known as catastrophic backtracking, is rejected. If you received that error when saving a JSON Schema, rewrite the regular expression patterns with bounded repetition instead of nested quantifiers.
Limits
These limits apply to every plan.
| Limit | Value |
|---|---|
| Schema size | 32 KB |
| JSON value size | 16 KB |
| Nesting depth of a schema | 50 levels |
Items in an enum | 1,000 |
| Regular expression patterns per schema | 32 |
| Length of any given regex pattern | 512 characters |
Branches across anyOf, oneOf, and allOf | 100 |
Hourly budgets on the Free plan
Validating the provided schema itself, and validating JSON against a schema are two of the most resource intensive operations we run. In order to protect our systems from abuse, the Free plan has a fair-use budget per organization, which resets every hour:
| Operation | Free plan | Paid plans |
|---|---|---|
| Schema updates per hour | 20 | No limit |
| JSON value validations per hour | 300 | No limit |
A schema updates is any save that adds, edits, or removes a schema. A value validation is any save of targeting rules or experiment variations for a config that has a JSON schema. When the budget is used up, the update is rejected with an error that says when the budget resets. The Admin API responds with HTTP status 429, and av error message in the response body.