
# Editor Setup

Point your editor at the [JSON Schema](/en/docs/json-schema) and a config file gains autocomplete, hover documentation, and errors underlined as you type — the same checks `sovrium validate` runs, minus the round trip to a terminal.

## VS Code

VS Code handles JSON Schema natively for `.json`. For `.yaml` and `.yml` it needs the **YAML** extension (`redhat.vscode-yaml`).

### Option 1: declare the schema in the file

The most portable option — the association travels with the config, so a teammate who clones the repo gets it without changing any settings.

```yaml
# yaml-language-server: $schema=https://sovrium.com/schema/app.json
name: my-app
```

Point it at a locally generated file instead to work offline, or to pin the exact version you deploy:

```yaml
# yaml-language-server: $schema=./app.schema.json
name: my-app
```

Generate that file with `sovrium schema --output app.schema.json` and commit it. Regenerate it whenever you upgrade Sovrium.

### Option 2: map it in `settings.json`

Better when several files across a workspace share the schema.

```json
{
  "yaml.schemas": {
    "https://sovrium.com/schema/app.json": ["app.yaml", "*.sovrium.yaml"]
  },
  "json.schemas": [
    {
      "fileMatch": ["app.json", "*.sovrium.json"],
      "url": "https://sovrium.com/schema/app.json"
    }
  ]
}
```

## JetBrains

IntelliJ IDEA, WebStorm and the other JetBrains IDEs map JSON Schemas natively — no plugin required, and the same mapping covers YAML and JSON.

Go to **Settings → Languages & Frameworks → Schemas and DTDs → JSON Schema Mappings**, click **+**, paste the schema URL (or the path to a generated `app.schema.json`), and set the file pattern to match your config — `app.yaml`, `app.json`, or a glob.

## What the schema does not cover

Editor validation is structural. It catches a misspelled property, a value of the wrong type, an enum member that does not exist. It does not catch cross-section mistakes — an automation naming a table that was never declared, a `$ref` pointing at a missing file — because those need the whole app resolved first.

Run [`sovrium validate`](/en/docs/config-validation) for that, and run it in CI. Green squiggles are a fast first pass, not the gate.

:::callout
**Authoring in TypeScript instead?** `app.ts` needs no schema mapping at all — `@sovrium/types` gives the editor the same information through the type system. See [TypeScript Configs](/en/docs/configuration-typescript).
:::

## Related Pages

- [JSON Schema](/en/docs/json-schema) — generating the schema and the hosted URLs.
- [Validating a Config](/en/docs/config-validation) — the check the editor cannot do.
- [Config Files: YAML & JSON](/en/docs/configuration-files) — the formats being edited.
