Editor support and the schema
Use the JSON Schema of pipeline files, step.yaml and packages.yaml in an editor, in a script or in an agent.
Available in repositories branchd reads pipeline files for. It is switching repositories on one at a time: until yours is, it keeps running its
.forge-ci.yamlor.xeonr-ci.yaml. See What is available.
The schemas are generated from the compiler's own key tables, and the compiler's tests check every example on these pages against them, so they name exactly the keys the compiler accepts.
| File | Schema |
|---|---|
.branchd/pipelines/*.yaml | https://docs.xeonr.io/schemas/branchd/pipeline.json |
step.yaml | https://docs.xeonr.io/schemas/branchd/step.json |
.branchd/packages.yaml | https://docs.xeonr.io/schemas/branchd/packages.json |
They are JSON Schema draft-07. A refused key that has a replacement (such as
variables:, which is env:) is listed with the refusal as its
description, so an editor says what to write instead.
A schema checks keys and the shape of values. It does not know whether a
need names a job, what an expression reads, or the limits: branchd ci lint
does, and is the check that counts.
In an editor
Editors that use yaml-language-server (VS Code's YAML extension, Neovim,
Helix, Zed, JetBrains IDEs) read a $schema comment on the first line of a
file. Put it above the path comment:
# yaml-language-server: $schema=https://docs.xeonr.io/schemas/branchd/pipeline.json
# .branchd/pipelines/ci.yamlOr map the files once, in VS Code's settings.json:
{
"yaml.schemas": {
"https://docs.xeonr.io/schemas/branchd/pipeline.json": ".branchd/pipelines/*.yaml",
"https://docs.xeonr.io/schemas/branchd/step.json": ["**/step.yaml"],
"https://docs.xeonr.io/schemas/branchd/packages.json": ".branchd/packages.yaml"
}
}In a script or an agent
Any JSON Schema validator that reads YAML will do. With Node.js:
npx --yes ajv-cli@5 validate --spec=draft7 \
-s pipeline.json -d .branchd/pipelines/ci.yamlwhere pipeline.json is the downloaded schema. An agent can fetch the schema
once and check each file it writes before running branchd ci lint; see
Writing pipelines with an AI agent.