Skip to content

Matches multiple schemas when only one must validate #1180

@yttriumz

Description

@yttriumz

Describe the bug

Wrong diagnostic message when using custom k8s schema instead of "kubernetes". Even if the custom schema is the same as the "kubernetes" one. I checked #247 but it's not the same thing.

Expected Behavior

Should not complain "Matches multiple schemas when only one must validate."

Current Behavior

Complains "Matches multiple schemas when only one must validate."

Steps to Reproduce

  1. Open a new folder in VSCode.
  2. Create a k8s yaml file like:
    apiVersion: v1
    kind: Service
    metadata:
      name: longhorn-ui-nodeport
      namespace: longhorn-system
    spec:
      type: NodePort
      ports:
      - port: 80
        targetPort: 80
        nodePort: 30080
      selector:
        app: longhorn-ui
  3. Create config file .vscode/settings.json with the following content, and make sure yaml.schemas is not configured in user settings:
    {
        "yaml.schemas": {
            "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.32.9-standalone-strict/all.json": [
                "*.yaml"
            ],
        }
    }
  4. The error happens.

Environment

  • Windows
  • Mac (VSCode 1.106.0 with redhat.vscode-yaml 1.19.1)
  • Linux
  • other (please specify)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions