Skip to content

Local YAML schema applied to schema file itself #894

@dmke

Description

@dmke

Describe the bug

I've got the following files:

  • permission.schema.yml

    ---
    $id:      urn:x-intern
    $schema:  http://json-schema.org/draft/2020-12/schema
    
    type: object
    additionalProperties:
      type: object
      required: [name]
      additionalProperties: false
      properties:
        name:
          type: string
  • permission.yml

    ---
    foo:
      name: bar
  • .vscode/settings.json

    {
      "yaml.schemas": {
        "./permission.schema.yml": "permission.yml"
      }
    }

Expected Behavior

The permission.schema.yml should not be applied to itself:

  1. It has its own $schema property, pointing to the JSON schema draft 2020-12.
  2. The configured glob pattern (permission.yml) does not match permission.schema.yml.

Current Behavior

The local schema is applied to the local schema itself, resulting in a false problem detection:

image

Steps to Reproduce

  1. Open VSCode in an existing or new workspace/folder.
  2. Create the files permission.yml, permission.schema.yml and .vscode/settings.json.
  3. Open the permission.schema.yml in the editor.
  4. Observe the errors/problems.

Environment

  • Windows
  • Mac
  • Linux (Debian 11, X11, Gnome)
  • other (please specify)

Extension is redhat.vscode-yaml v1.11.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions