redhat-developer / redhat-developer/yaml-language-server

Schema association with fallbacks (wildcards)

Open
#953 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

Summary

I would like to associate certain files with a specific schema and use a fallback for all other files.

The concrete usecase would be to provide schema association for Kubernetes CRDs and use the default Kubernetes schema for all other files.

Relevant information

This is the config I tried, but it seems that this will enable the Kubernetes schema even for the servicemonitor and cause validation errors:

yaml.schemas: {
	"https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/monitoring.coreos.com/servicemonitor_v1.json": "**servicemonitor.yaml",
	"kubernetes": "templates/**.yaml"
}

The Readme contains a similar example, which is quite confusing:

yaml.schemas: {
    "https://json.schemastore.org/composer": "/*",
    "kubernetes": "/myYamlFile.yaml"
}

From my understanding this will enable the composer schema (some php stuff I guess) for all files in the root directory but will also enable the Kubernetes schema for the file myYamlFile.yaml. Would you not get validation errors in the Kubernetes file from the composer schema?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README's yaml.schemas examples and the schema-association behavior described in the issue. Investigate how wildcard associations are matched and how overlapping schemas are selected; done means a specific CRD pattern uses its schema while other YAML files use the Kubernetes fallback without conflicting validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.