Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02
core https://github.com/sourcemeta/core f94f8b4bc7c1406ee37f86fe3c1886e8bedf70ee
core https://github.com/sourcemeta/core eff08dbc8da88db93c52643ff2eb84db1741b662
jsonbinpack https://github.com/sourcemeta/jsonbinpack abd40e41050d14d74af1fddb5c397de5cca3b13c
blaze https://github.com/sourcemeta/blaze e6da51b14d4a187b03c175af2c87395f9c150d15
hydra https://github.com/sourcemeta/hydra af9f2c54709d620872ead0c3f8f683c15a0fa702
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ add_jsonschema_test_unix(compile/pass_resolve_remap_relative)
# Lint
add_jsonschema_test_unix(lint/pass_lint_fix)
add_jsonschema_test_unix(lint/pass_lint_no_fix)
add_jsonschema_test_unix(lint/pass_lint_embedded_resource)
add_jsonschema_test_unix(lint/fail_lint)
add_jsonschema_test_unix(lint/fail_lint_embedded_resource)
add_jsonschema_test_unix(lint/fail_lint_invalid_embedded_resource)
add_jsonschema_test_unix(lint/fail_lint_with_id)
add_jsonschema_test_unix(lint/fail_lint_fix_broken_reference)
add_jsonschema_test_unix(lint/fail_lint_default_dialect)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cat << 'EOF' > "$TMP/schema.json"
"embedded": {
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "embedded",
"allOf": [ { "$ref": "#/definitions/foo" } ],
"$ref": "#/definitions/foo",
"definitions": {
"foo": { "type": "number" }
}
Expand All @@ -29,13 +29,15 @@ cd "$TMP"
"$1" lint "$TMP/schema.json" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?"
test "$CODE" = "1" || exit 1

cat "$TMP/stderr.txt"

cat << 'EOF' > "$TMP/expected.txt"
schema.json:10:7:
`definitions` was superseded by `$defs` in 2019-09 and later versions (definitions_to_defs)
at location "/$defs/embedded/definitions"
schema.json:9:20:
Wrapping `$ref` in `allOf` was only necessary in JSON Schema Draft 7 and older (unnecessary_allof_ref_wrapper_modern)
at location "/$defs/embedded/allOf/0/$ref"
schema.json:7:7:
A `$schema` declaration without a sibling identifier (or with a sibling `$ref` in Draft 7 and older dialects), is ignored (ignored_metaschema)
at location "/$defs/embedded/$schema"
EOF

diff "$TMP/stderr.txt" "$TMP/expected.txt"
29 changes: 29 additions & 0 deletions test/lint/pass_lint_embedded_resource.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

set -o errexit
set -o nounset

TMP="$(mktemp -d)"
clean() { rm -rf "$TMP"; }
trap clean EXIT

cat << 'EOF' > "$TMP/schema.json"
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/main",
"$ref": "embedded",
"$defs": {
"embedded": {
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "embedded",
"allOf": [ { "$ref": "#/definitions/foo" } ],
"definitions": {
"foo": { "type": "number" }
}
}
}
}
EOF

cd "$TMP"
"$1" lint "$TMP/schema.json"
5 changes: 4 additions & 1 deletion test/lint/pass_lint_list_exclude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ exclusive_minimum_number_and_minimum
if_without_then_else
The `if` keyword is meaningless without the presence of the `then` or `else` keywords

ignored_metaschema
A `$schema` declaration without a sibling identifier (or with a sibling `$ref` in Draft 7 and older dialects), is ignored

items_array_default
Setting the `items` keyword to the empty array does not add any further constraint

Expand Down Expand Up @@ -163,7 +166,7 @@ unsatisfiable_max_contains
unsatisfiable_min_properties
Setting `minProperties` to a number less than `required` does not add any further constraint

Number of rules: 51
Number of rules: 52
EOF

diff "$TMP/output.txt" "$TMP/expected.txt"
5 changes: 4 additions & 1 deletion test/lint/pass_lint_list_long.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ exclusive_minimum_number_and_minimum
if_without_then_else
The `if` keyword is meaningless without the presence of the `then` or `else` keywords

ignored_metaschema
A `$schema` declaration without a sibling identifier (or with a sibling `$ref` in Draft 7 and older dialects), is ignored

items_array_default
Setting the `items` keyword to the empty array does not add any further constraint

Expand Down Expand Up @@ -169,7 +172,7 @@ unsatisfiable_max_contains
unsatisfiable_min_properties
Setting `minProperties` to a number less than `required` does not add any further constraint

Number of rules: 53
Number of rules: 54
EOF

diff "$TMP/output.txt" "$TMP/expected.txt"
5 changes: 4 additions & 1 deletion test/lint/pass_lint_list_short.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ exclusive_minimum_number_and_minimum
if_without_then_else
The `if` keyword is meaningless without the presence of the `then` or `else` keywords

ignored_metaschema
A `$schema` declaration without a sibling identifier (or with a sibling `$ref` in Draft 7 and older dialects), is ignored

items_array_default
Setting the `items` keyword to the empty array does not add any further constraint

Expand Down Expand Up @@ -169,7 +172,7 @@ unsatisfiable_max_contains
unsatisfiable_min_properties
Setting `minProperties` to a number less than `required` does not add any further constraint

Number of rules: 53
Number of rules: 54
EOF

diff "$TMP/output.txt" "$TMP/expected.txt"
5 changes: 4 additions & 1 deletion test/lint/pass_lint_list_strict.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ exclusive_minimum_number_and_minimum
if_without_then_else
The `if` keyword is meaningless without the presence of the `then` or `else` keywords

ignored_metaschema
A `$schema` declaration without a sibling identifier (or with a sibling `$ref` in Draft 7 and older dialects), is ignored

items_array_default
Setting the `items` keyword to the empty array does not add any further constraint

Expand Down Expand Up @@ -172,7 +175,7 @@ unsatisfiable_max_contains
unsatisfiable_min_properties
Setting `minProperties` to a number less than `required` does not add any further constraint

Number of rules: 54
Number of rules: 55
EOF

diff "$TMP/output.txt" "$TMP/expected.txt"
22 changes: 10 additions & 12 deletions vendor/core/src/core/jsonschema/frame.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions vendor/core/src/core/jsonschema/transformer.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/core/src/extension/alterschema/CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vendor/core/src/extension/alterschema/alterschema.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions vendor/core/src/extension/alterschema/linter/ignored_metaschema.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading