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

Add JSON schemas to JSON store #279

Open
bdarcus opened this issue Jun 26, 2020 · 10 comments
Open

Add JSON schemas to JSON store #279

bdarcus opened this issue Jun 26, 2020 · 10 comments

Comments

@bdarcus
Copy link
Member

bdarcus commented Jun 26, 2020

Shouldn't we add our schemas to here, maybe when we release 1.1 (or simply latest)?

https://www.schemastore.org/json/

Seems tools are setup to auto find and consume them, for both json and yaml validation.

see #278

@denismaier
Copy link
Member

We should. Would be even useful for yaml validation in vscode

@bdarcus
Copy link
Member Author

bdarcus commented Jun 26, 2020

We should. Would be even useful for yaml validation in vscode.

Right; the YAML LSP will do validation using these schemas.

Let's do this.

@dhimmel - any thoughts on the versioning question here? Should we just do latest/master, at least to start?

Hold off until 1.1 is merged?

@bdarcus
Copy link
Member Author

bdarcus commented Jun 26, 2020

Here's the config content:

{
  "name": "bower.json",
  "description": "Bower package description file",
  "fileMatch": [ "bower.json", ".bower.json" ],
  "url": "http://schemastore.org/schemas/json/bower"
}

Is there any room for us defining new extensions here?

If not, how would we specify file matching (or not worry about it; it is optional)?

So something like:

{
  "name": "CSL Bib Data",
  "description": "CSL bibliographic input data",
  "url": "https://resource.citationstyles.org/schema/latest/input/json/csl-data.json"
}

@dhimmel
Copy link
Contributor

dhimmel commented Jun 26, 2020

Would be even useful for yaml validation in vscode

So this would allow vscode to autocomplete and validate CSL JSON/YAML? How does a text editor know that any given .json or .yaml file is CSL JSON and to use this spec? Is there something the file needs to include or does the user need to tell the text editor that the file should follow a certain schema?

@bdarcus
Copy link
Member Author

bdarcus commented Jun 26, 2020

In Atom, you can specify based on file extensions, etc, or allow the user to manually choose the grammar.

Not sure here.

@denismaier
Copy link
Member

Glob patterns work in vscode

@dhimmel
Copy link
Contributor

dhimmel commented Jun 26, 2020

Ideally there would be a way for the JSON file to specify what schema it intends to follow. VS Code supports $schema, but that is not a standard and it won't work for CSL JSON which uses an array as the top-level.

VS Code also supports a workspace setting, which is what I think @denismaier mentions in "Glob patterns work in vscode".

I have been naming my CSL JSON files like references.json. Do people here tend to use more verbose extensions to indicate CSL JSON? Like references.csl.json or references-csl.json? That would allow for a precise glob.

@dhimmel - any thoughts on the versioning question here? Should we just do latest/master, at least to start?

not yet

@bdarcus
Copy link
Member Author

bdarcus commented Jun 26, 2020

I have been naming my CSL JSON files like references.json. Do people here tend to use more verbose extensions to indicate CSL JSON? Like references.csl.json or references-csl.json? That would allow for a precise glob.

Not sure, but we could add it and recommend?

So *.csl.json and *.csl.yaml?

not yet

Let's sort out the outstanding issues with the input schema for 1.1, and then we can do this then?

The schema store doesn't appear to support versions.

@dhimmel
Copy link
Contributor

dhimmel commented Jun 26, 2020

I added the following in my workspace's .vscode/settings.json and the auto-complete is now working!

    "json.schemas": [
        {
            "fileMatch": [
                "*references*.json"
            ],
            "url": "https://github.com/dhimmel/csl-schema/raw/manubot/csl-data.json"
        }
    ]

So users can always specify https://resource.citationstyles.org/schema/latest/input/json/csl-data.json for the schema, but does JSON Store make this easier?

@bdarcus
Copy link
Member Author

bdarcus commented Jun 26, 2020

I know some tools have support for the store, so you can probably select the schema without knowing the URL?

That was the impression I got.

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

No branches or pull requests

3 participants