JSON Schema Reference
The complete Forma specification is available as a JSON Schema for validation and IDE autocompletion.
Download
Download Forma JSON Schema v1.0
Using the Schema
IDE Autocompletion
Add the $schema property to your Forma specification for editor support:
{
"$schema": "https://docs.formidable.software/schemas/forma/v1.json",
"version": "1.0",
"meta": {
"id": "my-form",
"title": "My Form"
}
}
This enables:
- Property autocompletion
- Inline documentation
- Validation errors in the editor
Supported Editors
- VS Code - Native JSON Schema support
- JetBrains IDEs - WebStorm, IntelliJ, etc.
- Sublime Text - With LSP plugin
- Vim/Neovim - With coc.nvim or similar
Programmatic Validation
Use any JSON Schema validator to validate Forma specifications:
JavaScript (Ajv):
import Ajv from "ajv";
import formaSchema from "./forma-v1.json";
const ajv = new Ajv();
const validate = ajv.compile(formaSchema);
const isValid = validate(myFormaSpec);
if (!isValid) {
console.log(validate.errors);
}
Python (jsonschema):
import json
from jsonschema import validate, ValidationError
with open('forma-v1.json') as f:
schema = json.load(f)
try:
validate(instance=my_forma_spec, schema=schema)
except ValidationError as e:
print(e.message)
Schema Contents
The JSON Schema defines:
Root Object (Forma)
| Property | Required | Description |
|---|---|---|
$schema | No | Schema URL for IDE support |
version | Yes | Must be "1.0" |
meta | Yes | Form metadata |
schema | Yes | JSON Schema for data structure |
fields | Yes | Field definitions |
fieldOrder | Yes | Field display order |
computed | No | Computed values |
referenceData | No | Lookup tables |
pages | No | Multi-page structure |
Meta Object
| Property | Required | Description |
|---|---|---|
id | Yes | Unique form identifier |
title | Yes | Form title |
description | No | Form description |
version | No | Form version string |
Field Definition
| Property | Description |
|---|---|
label | Display label |
description | Help text |
placeholder | Input placeholder |
type | Field type override |
visibleWhen | Visibility condition |
requiredWhen | Required condition |
enabledWhen | Enabled condition |
defaultValue | Initial value on load |
readonlyWhen | Read-only condition |
variant | Presentation variant hint |
variantConfig | Variant-specific configuration |
validations | Custom validation rules |
options | Select options |
itemFields | Array item fields |
minItems | Minimum array items |
maxItems | Maximum array items |
Validation Rule
| Property | Required | Description |
|---|---|---|
rule | Yes | FEEL expression |
message | Yes | Error message |
severity | No | "error" or "warning" |
Computed Field
| Property | Required | Description |
|---|---|---|
expression | Yes | FEEL expression |
label | No | Display label |
format | No | Display format |
display | No | Show in form |
Page Definition
| Property | Required | Description |
|---|---|---|
id | Yes | Unique page ID |
title | Yes | Page title |
description | No | Page description |
visibleWhen | No | Visibility condition |
fields | Yes | Fields on this page |
Version History
| Version | Date | Changes |
|---|---|---|
| 1.0 | 2024-01 | Initial release |