yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

Add support for ignoring individual schema validation errors

Open luolong opened this issue 1 year ago • 2 comments

Sometimes as developers we know exactly that we should be able to ignore certain schema validation errors.

Examples of such use cases would be:

  • Strategic merge patch of a Kustomization resource, that only defines the changes affected by a patch.
  • Partial Helm release values.yaml file (with appropriate values.schema.json schema) that is intended to be used alongside another values file.

We still want (almost) full assistance from our tools, including validation and auto completion of the document.

It would be much easier from the developer's perspective to simply add local ignore rules, that would allow us to specifically indicate that "yes, we know this here is an invalid document, but this particular validation error is okay in this case"

Copying and modifying a local copy of the schema to meet the particular idiosyncrasies of the document is not going to scale, as that adds an additional burden of maintaining the local schema to the already busy developers.

Most linting tools in the wild have added facilities to locally ignore certain linting/validation errors and it is an expectation that yaml schema validation would also add such options to our toolbox.

Having ability to mark up exceptions to the schema in the source of the document, gives clear indication to other developers of the intent and allows reasoning about validation error in the document. It is also easier to maintain fixed sets of exceptions than full copies of divergent schemas.

luolong avatar Aug 29 '23 09:08 luolong

This seems like the same that is reported in https://github.com/redhat-developer/vscode-yaml/issues/978 and https://github.com/redhat-developer/vscode-yaml/issues/666 — I'd like this feature as well!

this-fifo avatar Oct 03 '23 22:10 this-fifo

I agree, these are VERY similar.

luolong avatar Oct 05 '23 13:10 luolong