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

Define config TOML/JSON schema #966

Merged
merged 1 commit into from
Jan 3, 2023
Merged

Define config TOML/JSON schema #966

merged 1 commit into from
Jan 3, 2023

Conversation

dbarnett
Copy link
Collaborator

@dbarnett dbarnett commented Jan 2, 2023

Can be used with tools like taplo-lsp to show hints & validation in editors/IDEs. Won't apply automatically to config files until it's submitted to schemastore.org, but in the meantime it can be used via a schema directive
(https://taplo.tamasfe.dev/configuration/directives.html#the-schema-directive) or other manual config mechanism.

Context in #879.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have added tests to cover my changes

@dbarnett
Copy link
Collaborator Author

dbarnett commented Jan 2, 2023

See https://json-schema.org/ for details on how JSON schemas are interpreted.

FWIW, how I'm using this schema locally for now is to symlink REPO/src/schemas/json/jj.json to ~/.config/jj/_schema.json and then add this directive to the top of my ~/.config/jj/config.toml: #:schema ./_schema.json.

src/schemas/json/jj.json Outdated Show resolved Hide resolved
src/schemas/json/jj.json Outdated Show resolved Hide resolved
src/schemas/json/jj.json Outdated Show resolved Hide resolved
src/schemas/json/jj.json Outdated Show resolved Hide resolved
src/schemas/json/jj.json Outdated Show resolved Hide resolved
src/schemas/json/jj.json Outdated Show resolved Hide resolved
Can be used with tools like taplo-lsp to show hints & validation in
editors/IDEs. Won't apply automatically to config files until it's
submitted to schemastore.org, but in the meantime it can be used via a
schema directive
(https://taplo.tamasfe.dev/configuration/directives.html#the-schema-directive)
or other manual config mechanism.

Context in #879.
@dbarnett
Copy link
Collaborator Author

dbarnett commented Jan 2, 2023

Resolved all comments.

I don't know that a CHANGELOG update makes sense for this one since it's not explicitly hooked up yet as a jj feature, just a file that's in the repo if you know how to make use of it. Same for README/docs. And for tests, it's awkward to test the schema itself, but might make sense to hook up to some kind of testing eventually.

@martinvonz
Copy link
Owner

I don't know that a CHANGELOG update makes sense for this one since it's not explicitly hooked up yet as a jj feature, just a file that's in the repo if you know how to make use of it. Same for README/docs. And for tests, it's awkward to test the schema itself, but might make sense to hook up to some kind of testing eventually.

Agreed. That checklist is meant as a reminder (particularly for me, because I've often forgotten to update those things :))

Copy link
Owner

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Feel free to merge.

@dbarnett dbarnett merged commit 01e656e into main Jan 3, 2023
@dbarnett dbarnett deleted the config_schema branch January 3, 2023 02:26
dbarnett added a commit that referenced this pull request Jan 3, 2023
Extends TOML/JSON schema changes from #966 to allow jj to output the
schema directly. Context in #879.
dbarnett added a commit that referenced this pull request Jan 3, 2023
Extends TOML/JSON schema changes from #966 to allow jj to output the
schema directly. Context in #879.
dbarnett added a commit that referenced this pull request Jan 3, 2023
Extends TOML/JSON schema changes from #966 to allow jj to output the
schema directly. Context in #879.
dbarnett added a commit that referenced this pull request Jan 3, 2023
Extends TOML/JSON schema changes from #966 to allow jj to output the
schema directly. Context in #879.
dbarnett added a commit that referenced this pull request Jan 4, 2023
Extends TOML/JSON schema changes from #966 to allow jj to output the
schema directly. Context in #879.
dbarnett added a commit that referenced this pull request Jan 4, 2023
Extends TOML/JSON schema changes from #966 to allow jj to output the
schema directly. Context in #879.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants