vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

yaml.schemas Setting Schema

Open TMA-2 opened this issue 4 months ago • 1 comments

Is your enhancement related to a problem? Please describe.

The yaml.schemas setting doesn't describe the expected format in the package.json schema, so I had to look at the extension source to figure out what it wanted.

Describe the solution you would like

Add a more verbose format description with, at least, a default setting illustrating its usage, e.g.:

"contributes": {
  "configuration": {
    "properties": {
      "yaml.schemas": {
        "type": "object",
        "default": "\"./Path/To/Schema.json\": \"**/Glob/Matching/File.yaml\",\n\"https://my.site/schemas/schema.json\": \"**/Glob/Matching/OtherFile.yaml\"",
        "properties": { /* further validation, maybe? */ },
        "description": "Associate schemas to YAML files in the current workspace as an array of key-value pairs, with a file URI to the schema as key and a glob pattern to the yaml file(s) as value.\n\nFor more information, see [this link](https://www.asdf-format.org/projects/asdf-standard/en/1.0.1/schemas/yaml_schema.html#yaml-schema-draft-01)."
      }
    }
  }
},

Alternately, model it after the json.schemas schema found in <vs code install path>/resources/app/extensions/json-language-features/package.json. I'm sure this would be the more difficult option, as it would break the existing format and require changing how the setting is read and processed.

Describe alternatives you have considered

I haven't found any alternatives as yet — this seems to be pretty much the only game in town for full-featured YAML support including schema validation as far as I'm aware.

Additional context

N/A

TMA-2 avatar Sep 16 '25 16:09 TMA-2

Yeah, it seems helpful to improve the schema for that setting and I don't think it'll be a complicated change.

datho7561 avatar Dec 11 '25 21:12 datho7561