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

Newer/older Kubernetes schemas break autocompletion/diagnostics

Open
#778 3 comments 5 reactions 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

Summary

While debugging https://github.com/someone-stole-my-name/yaml-companion.nvim/issues/12 we've seen some bizarre behavior. One would expect yaml-language-server to work with Kubernetes schemas higher or lower than the one hardcoded if the user explicitly adds them, but that's not currently the case. Bumping even the patch version seems to break diagnostics and autocompletion behaves differently despite 1.22.4 and 1.22.5 being the same, e.g.

{
    "yaml.schemas": {
        "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.22.5-standalone-strict/all.json": "/*.yaml"
    }
}

With 1.22.5 the following document doesn't display the expected Property foo is not allowed.

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

And autocompletion is not working correctly either. Anything under spec: is not autocompleted as it does in 1.22.4:

apiVersion: networking.k8s.io/v1
kind: Ingress
spec:
Related:

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

Start with src/languageservice/utils/schemaUrls.ts, especially the hardcoded schema version, and reproduce the issue using the supplied yaml.schemas configuration and Kubernetes Ingress documents. Trace how an explicitly selected schema is resolved, then verify that both the foo diagnostic and spec: autocompletion work for schema versions such as 1.22.5.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.