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

[json] use the schemastore catalog #26289

Open
aeschli opened this issue May 9, 2017 · 12 comments · May be fixed by #69132
Open

[json] use the schemastore catalog #26289

aeschli opened this issue May 9, 2017 · 12 comments · May be fixed by #69132
Assignees
Labels
feature-request Request for new features or functionality json JSON support issues
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented May 9, 2017

The JSON server should use http://schemastore.org/api/json/catalog.json for schema associations

@aeschli aeschli self-assigned this May 9, 2017
@aeschli aeschli added json JSON support issues feature-request Request for new features or functionality labels May 9, 2017
@aeschli aeschli added this to the Backlog milestone May 9, 2017
@DoCode
Copy link

DoCode commented Oct 21, 2017

@aeschli, what is the status here?
How can we use a schema catalog with VS Code?

@aeschli
Copy link
Contributor Author

aeschli commented Oct 23, 2017

Schema associations can be set in the user settings and and by extensions. But we're not defaulting to the http://schemastore.org/api/json/catalog.json settings yet. No progress yet.

@DoCode
Copy link

DoCode commented Oct 23, 2017

@aeschli, thanks.
But my question was, how a schema catalog(catalog.json) can be used, like in VS.
Currently, I see the only option is, that the user must set a schema explicit per file. Schemastore.org has an elegant solution here.

@felixfbecker
Copy link
Contributor

After having such a great experience with most JSON files, and using this feature with the YAML language server, I was just wondering why a certain schema I added to SchemaStore wouldn't be used automatically without $schema. This would be really great to have

@jabby
Copy link

jabby commented Feb 14, 2019

Hello @aeschli
As you can see in this pull request eclipse-wildwebdeveloper/wildwebdeveloper#130, the feature will be really interesting for multiple editor.

I would like to contribute a patch based on the work already done on yaml-language-server project here https://github.com/redhat-developer/yaml-language-server/blob/master/src/server.ts#L269-L302

First, are you ok with my proposal. If so how can I test my work. I don't see any information on how launch the server and connect my vscode on it.

@jabby
Copy link

jabby commented Feb 14, 2019

In fact, I should read the main README of this repository. I will come back soon.

@aeschli
Copy link
Contributor Author

aeschli commented Feb 14, 2019

Yes, see https://github.com/Microsoft/vscode/blob/master/extensions/json-language-features/CONTRIBUTING.md

Yes, help is welcome, it would be great if you can give it a try.
What's important is that schema associations that are made in the user settings or by extensions will win against the associations from the catalog.

I'm worried that there will be wrong associations to certain files with common file names. That will lead to misleading code completions, hovers, and even validation errors. We need an easy way for users to disable automatic associations on such files.
I'm not really sure how we can do this. Any ideas?

@jabby
Copy link

jabby commented Feb 18, 2019

I give a try this week. I hope I will find time during lunch time.

I agree with you about the user settings. There are more important than automatic settings from the catalog. However I don't understand the extensions part of your message. Which extensions are you refering to?

For wrong association, I think we can create a settings like in the yaml-language-server.

"json": {
            // other settings like format and schemas associations
            "schemaStore": {
                "enable": true 
            }
        }

If the schemastore is disabled, we don't use the catalog to create associations between files and schemas. This mecanism can also be extended by another key in schemastore setting. I think a property like disableAssociations as an array of fileMatch is a quite good idea. What do you think about this?

@bd82
Copy link

bd82 commented Jan 26, 2020

Should installed Extensions exposing: contributes.jsonValidation have precedence on schemas coming from the SchemaStore?

@aeschli
Copy link
Contributor Author

aeschli commented Jan 27, 2020

Yes, schemas from the schema store should only be used if there's no association (as a fallback)

@csvn
Copy link
Contributor

csvn commented Mar 10, 2023

So many times schemas seem to "just work"™, that it's not really obvious at times why it does not. It's hard to realize that they are often provided by extensions. I just got hit by this issue when I was confused by renovate.json not loading the schema correctly.

Is there any work done here currently? #69132 seems to have stalled 😥

@Edstub207
Copy link

This seems like basic functionality that should work out of the box? Is anything happening with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality json JSON support issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants