Schema associations
Use yaml.schemas to map a schema path or URL to a filename or glob. In VS Code, place the association in .vscode/settings.json. To apply the same mapping in the checker, use .oxyaml.toml.
{ "yaml.schemas": { "./schemas/service.json": "services/*.yaml" }}To select a schema directly in a YAML file, add a modeline.
Docker Compose
To check a Compose file with a custom name, put this modeline on its first line to select the Compose schema.
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/main/schema/compose-spec.jsonRun oxyaml check path/to/compose.yaml to check the file from the command line.
Kubernetes
Associate a glob with the special kubernetes schema to select the schema based on each manifest’s apiVersion and kind.
{ "yaml.schemas": { "kubernetes": ["deploy/**/*.yaml", "deploy/**/*.yml"] }}See the settings reference for the Kubernetes version and custom resource schema options.