Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set specific Kubernetes Schema Version #211

Open
joshrosso opened this issue Jan 3, 2020 · 5 comments · May be fixed by #841
Open

Set specific Kubernetes Schema Version #211

joshrosso opened this issue Jan 3, 2020 · 5 comments · May be fixed by #841

Comments

@joshrosso
Copy link

joshrosso commented Jan 3, 2020

It appears the Kubernetes schema is hardcoded at https://github.com/redhat-developer/yaml-language-server/blob/master/src/server.ts#L32.

Is it possible to set a specific version? For example, if I wanted to use https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.16.0-standalone-strict/all.json?

I tried

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

but no luck.

For now, editing server.ts on my local machine works well. I wonder if an [optional] environment variable could be helpful?

@apupier
Copy link
Member

apupier commented Jul 21, 2020

It appears the Kubernetes schema is hardcoded at https://github.com/redhat-developer/yaml-language-server/blob/master/src/server.ts#L32.

it has been moved to

export const KUBERNETES_SCHEMA_URL = 'https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.17.0-standalone-strict/all.json';

Using the yaml.schemas should be something working. I think it is a matter of priorities in schema resolution. hope it would be handled with #250

Another solution would be to be able to specify the yaml schema in the yaml data file directly #204

I wonder if an [optional] environment variable could be helpful?

I'm not a big fan of environment variable as it can have collateral effect but it seems a quick win to add this possibility. (and given the number of +1 on this issue ti can allow to please a lot of people)

@JPinkney From technical point of view, is it a matter of modifying only

if (uri.trim().toLowerCase() === 'kubernetes') {
return KUBERNETES_SCHEMA_URL;
?

@JPinkney
Copy link
Contributor

Yes I believe so. But TBH I question if we should even have the kubernetes schema embedded in this extension anymore and should just tell people to add it if they want

@joshrosso
Copy link
Author

@JPinkney I think that's the right move.

It feels weird that Kubernetes is just kind of embedded and "works" (assuming the version is good :p) when you turn it on.

@JPinkney
Copy link
Contributor

@joshrosso Yeah, this language server originally started (3~ years ago) as a kubernetes language server and once we found out that the support for kubernetes worked well we expanded it to all of yaml but kept that schema embedded. That's why its been there for so long

@joshrosso
Copy link
Author

@JPinkney 100% makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants