vidmake v0.2.1
Download

Docs/ToolingPage 39 / 45

JSON Schema

Use the JSON Schema printed by vidmake schema (and served at /schema.json) for editor completion and pre-checks in other tools, and know what it checks compared with vidmake validate.

View .md Ask Claude Ask ChatGPT

vidmake schema prints a JSON Schema (draft 2020-12) describing project files: every composition and layer field, the layer types, the animation forms, paints, presets and lint codes, with short descriptions. It's generated from the same field lists the parser uses (a test fails if they drift apart), so it always matches the binary that printed it.

bash
vidmake schema > vidmake.schema.json

The schema of the current release is also served by this site at /schema.json:

code
https://vidmake.app/schema.json

Use it for editor autocompletion and hover docs, and for a quick structural check in tools that don't have vidmake installed. It is not a replacement for vidmake validate, which compiles the project.

#What's in it

vidmake schema (top)json
{  "$schema": "https://json-schema.org/draft/2020-12/schema",  "$id": "https://vidmake.app/schema.json",  "title": "vidmake project",  "description": "Generated by `vidmake schema`. Run `vidmake docs` for semantics.",  "oneOf": [    { "type": "object", "additionalProperties": false, "required": ["compositions"],      "properties": { "$schema": { "type": "string" }, "fonts": { ... }, "compositions": { ... } } },    { "$ref": "#/$defs/bareComposition" }  ],  "$defs": { "time", "key", "ease", "anim", "num", "color", "paint", "preset", "lintCode", "layer", "composition", "bareComposition" }}

(Abbreviated; the full schema is about 1,200 lines.)

definitiondescribes
roota project { "fonts", "compositions" }, or a single bare composition with layers
compositionid, width, height required; fps, duration (time or "auto"), background, props, layers, motionBlur, grain, description
bareCompositionthe same fields with width, height and layers required (id defaults to main)
layerall 88 layer fields, type required and one of the 16 layer types
numa number, "50%", an "=expression", keyframes [[t, v], ...], or a tween/keys object (see animation)
color, paintcolor strings and arrays, animated colors, null, linear/radial gradients (see colors)
timeframes (number) or "1.5s", "500ms", "45f", "m:ss" (see time)
presetan enter/exit name or {type, duration, delay, ease, distance}
lintCodeoffCanvas, textOverflow, invisible, zeroDuration, afterEnd, all (see lint)

Every object is closed (additionalProperties: false), so misspelled field names are flagged by the editor as you type, the same mistakes validate reports as unknown field `fontsize` — did you mean `fontSize`?.

#Editor setup

#VS Code

Point VS Code's JSON language service at the schema in your workspace or user settings.json:

.vscode/settings.jsonjson
{  "json.schemas": [    {      "fileMatch": ["project.json", "*.vidmake.json", "videos/**/*.json"],      "url": "https://vidmake.app/schema.json"    }  ]}

To pin the schema to the vidmake version you have installed (recommended: the hosted file tracks the latest release), generate it into the repository and use a relative path:

bash
vidmake schema > .vscode/vidmake.schema.json
.vscode/settings.jsonjson
{  "json.schemas": [    { "fileMatch": ["project.json", "*.vidmake.json"], "url": "./.vscode/vidmake.schema.json" }  ]}

Regenerate the file after vidmake update. Other editors with a JSON language server (JetBrains IDEs, Neovim with jsonls, Zed, Helix) take the same URL or file in their JSON schema mapping settings.

#$schema in the file

The project form accepts a "$schema" key at the top level, which many editors (including VS Code) pick up without any settings:

project.jsonjson
{  "$schema": "https://vidmake.app/schema.json",  "compositions": [    { "id": "main", "width": 1920, "height": 1080, "duration": "5s", "layers": [] }  ]}

vidmake ignores the key when rendering. It is only allowed at the top of the project form: a file that is a single bare composition rejects it (composition `main`: unknown field `$schema` ), so wrap the composition in {"compositions": [...]} if you want it.

#Validating with other tools

Any draft 2020-12 validator works:

bash
# Node (ajv-cli 5)npx ajv-cli validate --spec=draft2020 -s vidmake.schema.json -d project.json # Python (check-jsonschema)check-jsonschema --schemafile vidmake.schema.json project.json

Because the root is a oneOf (project or bare composition), validators report the errors of both branches. The first one is usually the useful one; the others say the file doesn't match the other branch. For a project with a misspelled fontSize, ajv prints:

output
project.json invalid[  {    instancePath: '/compositions/0/layers/0',    schemaPath: '#/additionalProperties',    keyword: 'additionalProperties',    params: { additionalProperty: 'fontsize' },    message: 'must NOT have additional properties'  },  {    instancePath: '',    schemaPath: '#/required',    keyword: 'required',    params: { missingProperty: 'width' },    message: "must have required property 'width'"  },  {    instancePath: '',    schemaPath: '#/oneOf',    keyword: 'oneOf',    params: { passingSchemas: null },    message: 'must match exactly one schema in oneOf'  }]

Some validators only report "is not valid under any of the given schemas" at the root. Ask for the best-matching error to get the useful one. In Python, with jsonschema:

check.pypython
import json, sysfrom jsonschema import Draft202012Validatorfrom jsonschema.exceptions import best_match schema = json.load(open(sys.argv[1]))project = json.load(open(sys.argv[2]))error = best_match(Draft202012Validator(schema).iter_errors(project))if error:    print("/".join(map(str, error.absolute_path)) or "/", "-", error.message)    sys.exit(1)print("ok")
output
$ python3 check.py vidmake.schema.json project.jsoncompositions/0/layers/0 - Additional properties are not allowed ('fontsize' was unexpected)

A schema check is useful where vidmake isn't installed: a web form that collects project JSON, a pre-commit hook, an LLM tool definition that should only produce well-formed projects, or a server that accepts jobs before handing them to a render worker.

For agents

If you generate projects through a structured-output or tool-calling API, the schema can constrain the shape. Still run vidmake validate on the result: the schema can't know whether a font exists, a file is there, or an expression parses.

#Schema vs vidmake validate

The schema checks shape. validate compiles the project the way render does, then lints it.

checkschemavalidate
unknown or misspelled fieldsyesyes, with a "did you mean" suggestion
required composition fields, value types, enums (blendMode, lineCap, fit, ...)yesyes
lint codesyesyes
a field that doesn't apply to the layer type (fontSize on a rect)no: every layer field is allowed on every typeyes: field(s) fontSize do not apply to `rect` layers
fields required by a type (text for text, src for media, d for path, ref for use)noyes
files exist (src, font path, captions), media has the expected streamsnoyes
font families are installed or declarednoyes
expression syntax and function names ("=sinn(t)")noyes
easing, preset and transition namesno (any string)yes
time stringsbasic pattern onlyfully parsed
{{prop}} placeholdersno; and placeholders in enum or time fields fail the schema (see below)substituted first, then checked
attach targets, use references, series children having durationsnoyes
layout lint: off-canvas, overflowing, invisible, mistimed layersnoyes, as warnings

Warning

The schema validates the file before props are applied. A placeholder in a field with an enum or a pattern, such as "blendMode": "{{mode}}" or "duration": "{{seconds}}", is valid for vidmake but fails the schema check. Numeric and color fields accept any string, so "x": "{{left}}" passes both.

The order that catches the most mistakes for the least work: editor schema while typing, vidmake validate before looking at anything, then storyboard and inspect.