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

Can´t ignore, disable or change schema for certain files - kustomization yaml patches in this case

Open rille111 opened this issue 3 years ago • 2 comments

Describe the bug

Can´t ignore / disable or change the schema for validation on certain files. In this case it´s a kustomization patch file. It wants to validate to the kubernetes schema, therefore complains that the .yaml patch file doesn´t match the expectations.

Example

patch.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
spec:
  replicas: 1

Possible solution

I could see a solution that configuring settings.json would ignore or at least change the validation schema following a glob pattern. Example:

{
    "yaml.schemas": {
        "https://json.schemastore.org/yamllint.json": "**/patch.yaml",
     }
}

Or

{
    "yaml.schemas": {
        "ignore": "**/patch.yaml",
     }
}

Expected Behavior

Different schema to validate against, or disable altogether.

Current Behavior

Everything gets validated according to kubernetes if it sees kubernetes stuff inside the yamls.

Steps to Reproduce

  1. Create a patch.yaml
  2. Use the previously attached code
  3. Observe the problems in VSCode

Environment

  • [x ] Windows
  • [ ] Mac
  • [ ] Linux
  • [ ] other (please specify)

rille111 avatar Oct 29 '21 13:10 rille111

Everything gets validated according to kubernetes if it sees kubernetes stuff inside the yamls.

Do you have vscode-kubernetes-tools or some other kubernetes related extension installed in VSCode? As far as I can remember in this extension we don't do any automatic schema matching for kubernetes you have to set everything manually. Whereas vscode-kubernetes-tools looks to see if the content looks like kubernetes yaml and if it is then applies the schemas itself

JPinkney avatar Oct 29 '21 14:10 JPinkney

Do you have vscode-kubernetes-tools or some other kubernetes related extension installed in VSCode?

Yes, as a matter of fact I do. I guess more people should have problems with this. Guess it's not the scope of this VSCode Extension.

rille111 avatar Oct 29 '21 14:10 rille111

Closing as this is on the purview of vscode-kubernetes-tools

gorkem avatar Mar 24 '23 17:03 gorkem