/templates/schema/v1.json. Point your editor at it and vertracloud.template.yaml is validated and autocompleted as you type, with no tool to install besides a YAML extension. The schema is generated from the same definition the API uses to validate manifests, so it does not drift from the platform.
Use it in your editor
Add this comment as the first line of the manifest:- autocomplete for every field and enum (
category,language,web,database, …); - an error underline for unknown fields, wrong types, values out of range and patterns that do not match (for example an
idwith capital letters).
Use it in CI
Any JSON Schema validator can check a manifest after you parse the YAML to JSON. For example, withajv-cli:
vertra template validate.
What the schema checks
The schema checks the shape of the manifest: which fields exist, their types and enums, string patterns, numeric ranges and lengths, array sizes, and which fields each kind of service requires.What only the API checks
Some rules cannot be written in JSON Schema because they look at several fields at once or at the state of the platform. The CLI, the editor, the API and the CI of the public repository run them with the same code:- placeholders that point to services, questions or secrets that exist;
whenthat refers to an earlier question, with anequalsof the right type;- a
selectquestion with options, and adefaultthat is one of them; recommendednot belowmin, andmaxnot belowrecommended;- image fields on code services and code fields on image services;
min_planthat is the id of a real plan, and a databaseversionthat is available;- unsafe regular expressions in
validation.regex; - platform-controlled variable names, and literal values that look like secrets;
- permission combinations, and fields reserved for private or for public templates.
Versioning
The file name carries the version:v1.json describes manifest format v1. A format change that is not compatible would be published under a new file name instead of replacing v1.json. Point your editor at the version you wrote your manifest against.
Related
Manifest reference
Every field in prose, with examples.
Validate and test
The CLI, the API and the validation codes.