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

Inconsistent behavior with inlined schemas

Open
#777 2 comments 1 reaction 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

Describe the bug

When using the inlined schemas the behavior is different vs when the schema is defined in the settings.

Expected Behavior

The behavior should be the same, doesn't matter if the user sets the schema inline or in configuration.

Current Behavior

The diagnostics do not work or are different.

Steps to Reproduce

  1. Start with a blank config and create a file with the following content:
# yaml-language-server: $schema=https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.4-standalone-strict/all.json
apiVersion: networking.k8s.io/v1
kind: Ingress
foo: bar

It doesn't trigger any diagnostics but autocompletion works.

  1. Configure the schema to apply to all YAML files in the settings:
{
    "yaml.schemas": {
        "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.4-standalone-strict/all.json": "/*.yaml"
    }
}

Create a file with the following content:

apiVersion: networking.k8s.io/v1
kind: Ingress
foo: bar

It triggers the expected diagnostics:

  • Property foo is not allowed.yaml-schema: https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.4-standalone-strict/_definitions.json

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

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

Reproduce the two configurations described in the issue: an inline YAML schema directive and the same schema configured through yaml.schemas. Compare diagnostics while confirming that autocompletion continues to work; done means both schema sources produce the same expected diagnostic for the unsupported foo property.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.