Skip to content

Set up your editor

Your editor completes field names, underlines a field that doesn’t exist and describes a field on hover as you write the Model YAML.

1. Map the schemas to the Workspace’s files

Section titled “1. Map the schemas to the Workspace’s files”

The Model, every file Archidocs reads, is written in YAML. The archidocs npm package ships a schema for each kind of YAML file, in its schemas/ folder:

File Schema
archidocs/workspace.yaml workspace.schema.json
archidocs/<project>/project.yaml project.schema.json
Every other .yaml file in a Project, one Team’s folder model.schema.json

In VS Code, add the yaml.schemas setting to the repo’s .vscode/settings.json. Commit it, so everyone who opens the repo gets the same setup:

.vscode/settings.json
{
"yaml.schemas": {
"https://cdn.jsdelivr.net/npm/archidocs@1/schemas/workspace.schema.json": "archidocs/workspace.yaml",
"https://cdn.jsdelivr.net/npm/archidocs@1/schemas/project.schema.json": "archidocs/*/project.yaml",
"https://cdn.jsdelivr.net/npm/archidocs@1/schemas/model.schema.json": ["archidocs/*/*.yaml", "!archidocs/*/project.yaml"]
}
}

The editor reads the schemas from jsDelivr, which serves the files of the npm package. archidocs@1 is the latest 1.x release. If you pin the CLI to an exact version, write that version in the URLs too.

The patterns are relative to the folder open in the editor. The ! pattern leaves project.yaml to its own schema.

In another editor, pass the same yaml.schemas map in the editor’s settings for yaml-language-server, under the yaml key.

2. Read the schemas from node_modules instead

Section titled “2. Read the schemas from node_modules instead”

Skip this step if the URLs work for you. If the repo installs archidocs as a dev dependency, or the editor can’t reach jsDelivr, point the same setting at the installed package instead:

Terminal window
npm install --save-dev archidocs

Then replace https://cdn.jsdelivr.net/npm/archidocs@1/schemas/ with ./node_modules/archidocs/schemas/ in each of the three entries. The schemas then always match the installed CLI.

Open archidocs/<project>/model.yaml and start a new line inside a Service, at the indent of its name. Press Ctrl+Space. The editor lists the fields the Service doesn’t set yet. For the spa Service from the tutorial, VS Code offers:

components external in links owner tags type

Type a field that doesn’t exist, such as color: red. The editor underlines it:

Property color is not allowed.

Hover a field to read its description, the same text as the Model YAML reference. The schemas carry descriptions from the release after 1.2.0. With 1.2.0, the hover names only the file’s schema.

If nothing completes and nothing is underlined, the file matched no pattern. Open the repo’s root folder in the editor, not archidocs/. If the Workspace is in a subfolder of the repo, add that folder to each pattern, such as infra/archidocs/*/*.yaml.

If the editor reports that it can’t load the schema, it can’t reach jsDelivr. Read the schemas from node_modules, as in step 2.

The schemas check each file’s shape, one file at a time. They can’t know which ids exist in the other files. A misspelled id in to is only reported by archidocs check, as unknown-element.

Documents the beta branch at cd98671, ahead of the latest release, v1.4.0.