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

config-schema: allow arrays of strings for ui.editor and ui.diff.tool #5651

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steadmon
Copy link
Member

Fixes #5617

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@@ -140,7 +140,10 @@
"default": "color-words"
},
"tool": {
"type": "string",
Copy link
Contributor

@ilyagr ilyagr Feb 11, 2025

Choose a reason for hiding this comment

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

This seems to work, thanks!

Could you do the same for ui.pager? It actually also accepts a third config (an object with command and env fields; I'm not sure whether or not diff-tool and editor accept these), but we could omit that for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, although I'm a bit iffy about the command and env fields. From looking at CommandNameAndArgs in cli/src/config.rs I think we can have either a string or array once again for command. env is just a hash of strings, which I'm assuming maps to a Table in TOML and an object in json-schema.

It might be nice to have a test that checks the schema actually validates some reasonable example config. Do you think that's worth doing in this PR, or should I file an issue for it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

I thought you would just make the pager variable the same as the others. I imagine few people outside jj's builtin config use the object notation.

I think what you have is OK. (Very optionally) you could probably make it better by setting up a schema for the pager object notation in the definitions of the schema and using oneOf, there are a few examples of that inside the schema.

It might be nice to have a test that checks the schema actually validates some reasonable example config. Do you think that's worth doing in this PR, or should I file an issue for it?

That would be wonderful, but I think it can be a separate PR.

@steadmon steadmon force-pushed the push-vyvlpokvlzoy branch 2 times, most recently from a80da3a to 51384ba Compare February 11, 2025 00:41
@@ -140,7 +140,10 @@
"default": "color-words"
},
"tool": {
"type": "string",
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

I thought you would just make the pager variable the same as the others. I imagine few people outside jj's builtin config use the object notation.

I think what you have is OK. (Very optionally) you could probably make it better by setting up a schema for the pager object notation in the definitions of the schema and using oneOf, there are a few examples of that inside the schema.

It might be nice to have a test that checks the schema actually validates some reasonable example config. Do you think that's worth doing in this PR, or should I file an issue for it?

That would be wonderful, but I think it can be a separate PR.

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.

config schema raises an error when using an array for ui.editor
2 participants