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

yaml.schemas priority is lower than schemaStore #250

Closed
alex-enchi opened this issue Apr 10, 2020 · 7 comments
Closed

yaml.schemas priority is lower than schemaStore #250

alex-enchi opened this issue Apr 10, 2020 · 7 comments
Labels

Comments

@alex-enchi
Copy link

I was trying to use vscode-yaml for ansible configuration recently, specifically this one schema http://json.schemastore.org/ansible-stable-2.9 but there's a small bug where yum supports only string as input.

Afterwards I've added configuration to use custom schema

"settings": {
		"yaml.schemas": {
			"./ansible-stable-2.9-local.json": "*",
		}
	}

I guess that file loads properly, because on hover it gets proper description for properties and autocomplete, but validation not.

After I've added "yaml.schemaStore.enable": false, to settings I am getting both hover information and rules from local file.

@gorkem gorkem added the bug label Jun 11, 2020
@apupier
Copy link
Member

apupier commented Jul 15, 2020

@JPinkney do you have pointers to improve that?

I was looking to

public getSchemaForResource (resource: string, doc = undefined): Thenable<ResolvedSchema> {
but I don't see any other reference to this.filePatternAssociations so don't understand how it is built.
We would need having 2 lists? one from schemastore and one from yaml.schemas?
Maybe also need to differentiate the languageSettings.schemas
languageSettings.schemas.push({ uri: schema.url, fileMatch: [currFileMatch] });
?

@JPinkney
Copy link
Contributor

filePatternsAssociations stuff is all passed through to the JSON language service IIRC.

I think to fix this issue we need to introduce priorities for schemas like suggested. Something like redhat-developer/vscode-yaml#151 should always be priority 1, meaning that if it is present, no matter what it will use it and nothing else.

Then I think local schemas can be priority 2, meaning any other local schemas can be matched with the file.

Then schema store schemas would be priority 3 and are only used if nothing else matches.

@idoprz
Copy link

idoprz commented Jan 8, 2021

Hi @gorkem ,
Nice to meet once again :)

I have somewhat similar problem. There is some schema in the store that matches everything with the keyword "deploy". The store also have specific match for filetype "ui5-deploy.yaml", which is the schema i want to be used.
Should the matcher have higher priority for exact match (in my case ui5-deploy.yaml)? or somehow to be able to configure it?
I also tried to override it somehow using yaml.schemas but it doesn't work.

@JPinkney
Copy link
Contributor

This issue should be fixed in 0.14.0! yaml.schemas should not have a higher priority than the schemaStore. If there are still any issues please let me know.

@idoprz Can you please open a separate issue with that info when you get a chance. As of 0.14.0 all schemas coming from the same source are equally valid regardless of whether they are an exact match or matched with a glob pattern

@JefferyHus
Copy link

@JPinkney This issue is still happening.

Screenshot 2021-03-23 at 20 38 32

Screenshot 2021-03-23 at 20 37 33

@alex-kinokon
Copy link

Still reproducible.

@sangdth
Copy link

sangdth commented Nov 30, 2021

Still reproducible.

I can confirm I still have this issue in openapi.yaml, where my custom "yaml.schema.openapi" has no effect, and the schemaStore still enforce it with 3.1.0.
Screenshot 2021-11-30 at 12 17 58

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

No branches or pull requests

8 participants