Skip to content

Commit

Permalink
json schema: set schema version to draft-4, clarify taplo support
Browse files Browse the repository at this point in the history
"$comment" is not officially supported by draft-4, but it is in newer
drafts, and JSON schema readers are supposed to skip fields that
are not known to them.
  • Loading branch information
ilyagr committed Feb 11, 2025
1 parent 31c3d93 commit 890c435
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cli/src/config-schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$schema": "http://json-schema.org/draft-04/schema",
"$comment": "`taplo` and the corresponding VS Code plugins only support draft-04 verstion of JSON Schema, see <https://taplo.tamasfe.dev/configuration/developing-schemas.html>. draft-07 is mostly compatible with it, newer versions may not be.",
"title": "Jujutsu config",
"type": "object",
"description": "User configuration for Jujutsu VCS. See https://jj-vcs.github.io/jj/latest/config/ for details",
Expand Down
7 changes: 4 additions & 3 deletions cli/tests/test_util_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ fn test_util_config_schema() {
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["util", "config-schema"]);
// Validate partial snapshot, redacting any lines nested 2+ indent levels.
insta::with_settings!({filters => vec![(r"(?m)(^ .*$\r?\n)+", " [...]\n")]}, {
assert_snapshot!(stdout, @r###"
assert_snapshot!(stdout, @r#"
{
"$schema": "http://json-schema.org/draft-07/schema",
"$schema": "http://json-schema.org/draft-04/schema",
"$comment": "`taplo` and the corresponding VS Code plugins only support draft-04 verstion of JSON Schema, see <https://taplo.tamasfe.dev/configuration/developing-schemas.html>. draft-07 is mostly compatible with it, newer versions may not be.",
"title": "Jujutsu config",
"type": "object",
"description": "User configuration for Jujutsu VCS. See https://jj-vcs.github.io/jj/latest/config/ for details",
Expand All @@ -35,7 +36,7 @@ fn test_util_config_schema() {
[...]
}
}
"###);
"#);
});
}

Expand Down

0 comments on commit 890c435

Please sign in to comment.