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

Reserve top-level $schema property? #107

Open
natemoo-re opened this issue Jan 21, 2022 · 3 comments
Open

Reserve top-level $schema property? #107

natemoo-re opened this issue Jan 21, 2022 · 3 comments

Comments

@natemoo-re
Copy link

Visual Studio Code supports a top-level $schema property which provides their JSON Language Server with automatic completions, hovers, etc. While it is not part of the JSON Schema specification, it is a feature that I see being used with increasing frequency. See schemastore.org for examples of tools which have public schemas.

IMO calling this property out in the specification would be wise, even just as something that tools should accept but ignore. I've definitely encountered tools that have trouble validating or parsing a JSON file when $schema is used and it can be a pain.

@natemoo-re
Copy link
Author

While we're on the topic of JSON Schema, I started working on a public schema that aligns with much of the current draft. My current version is a little more opinionated in group structure than the spec, but I'm sure the token definitions are still useful.

I'm happy to contribute to an official spec schema if there's interest!

@TravisSpomer
Copy link

Definitely agree with this. The token format is currently missing some kind of versioning field anyway, and $schema could potentially even be used for that purpose too, though I'm not entirely sure if that's wise.

@c1rrus
Copy link
Member

c1rrus commented Jan 25, 2022

I agree this could be useful and could double as a versioning field (something we've been meaning to add anyway). We could have the spec version that the file conforms to as part of the URL to the corresponding schema. E.g.:

{
  "$schema": "https://designtokens.org/spec/v1.2.3/schema.json",
  // ^ This file follows version 1.2.3 of the DTCG spec

  // tokens and groups go here as per usual
}

I also agree that having a JSON schema for our spec could be useful. It would allow some basic validation of files and can enable some auto-completion features in some IDEs. It's something that's been suggested before and has been discussed at previous editors meetings too. We've just not gotten around to properly exploring the topic yet. When we do, I'm sure @natemoo-re's schema will be a valuable input, so thanks for sharing that!

Also, since we've now decided to use $ as our prefix for all format-specific properties, this would fit in nicely with that :-)

@kaelig kaelig added dtcg-format All issues related to the format specification. Needs Feedback/Review Open for feedback from the community, and may require a review from editors. labels Mar 8, 2022
@kevinmpowell kevinmpowell added this to the Next Draft Priority milestone Oct 3, 2022
@kevinmpowell kevinmpowell removed Needs Feedback/Review Open for feedback from the community, and may require a review from editors. dtcg-format All issues related to the format specification. labels Oct 3, 2022
@kevinmpowell kevinmpowell self-assigned this Apr 3, 2023
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

5 participants