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

Upgrade JSON Toolkit to 2b5158f2 #161

Merged
merged 1 commit into from
Aug 29, 2024
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 dea311b5bfb53b6926a4140267959ae334d3ecf4
noa https://github.com/sourcemeta/noa 7e26abce7a4e31e86a16ef2851702a56773ca527
jsontoolkit https://github.com/sourcemeta/jsontoolkit 9a88c7331742360abc06317bbce4df6afd11c61b
jsontoolkit https://github.com/sourcemeta/jsontoolkit 2b5158f237584fff7e35d520c2e5a722d01fd678
hydra https://github.com/sourcemeta/hydra 3c53d3fdef79e9ba603d48470a508cc45472a0dc
alterschema https://github.com/sourcemeta/alterschema a31722f04ae2d7e57f2fe5bbb0613670866c0840
3 changes: 2 additions & 1 deletion src/command_compile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ auto sourcemeta::jsonschema::cli::compile(
const auto compiled_schema{sourcemeta::jsontoolkit::compile(
schema, sourcemeta::jsontoolkit::default_schema_walker,
resolver(options, options.contains("h") || options.contains("http")),
sourcemeta::jsontoolkit::default_schema_compiler)};
sourcemeta::jsontoolkit::default_schema_compiler,
sourcemeta::jsontoolkit::SchemaCompilerCompilationMode::Optimized)};

const sourcemeta::jsontoolkit::JSON result{
sourcemeta::jsontoolkit::to_json(compiled_schema)};
Expand Down
2 changes: 1 addition & 1 deletion src/command_fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ auto sourcemeta::jsonschema::cli::fmt(
log_verbose(options) << "PASS: " << entry.first.string() << "\n";
} else {
std::cerr << "FAIL: " << entry.first.string() << "\n";
std::cerr << "Got: \n"
std::cerr << "Got:\n"
<< buffer.str() << "\nBut expected:\n"
<< expected.str() << "\n";
return EXIT_FAILURE;
Expand Down
3 changes: 2 additions & 1 deletion src/command_metaschema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ auto sourcemeta::jsonschema::cli::metaschema(
if (!cache.contains(dialect.value())) {
const auto metaschema_template{sourcemeta::jsontoolkit::compile(
metaschema, sourcemeta::jsontoolkit::default_schema_walker,
custom_resolver, sourcemeta::jsontoolkit::default_schema_compiler)};
custom_resolver, sourcemeta::jsontoolkit::default_schema_compiler,
sourcemeta::jsontoolkit::SchemaCompilerCompilationMode::Optimized)};
cache.insert({dialect.value(), metaschema_template});
}

Expand Down
3 changes: 2 additions & 1 deletion src/command_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ auto sourcemeta::jsonschema::cli::test(
try {
schema_template = sourcemeta::jsontoolkit::compile(
schema.value(), sourcemeta::jsontoolkit::default_schema_walker,
test_resolver, sourcemeta::jsontoolkit::default_schema_compiler);
test_resolver, sourcemeta::jsontoolkit::default_schema_compiler,
sourcemeta::jsontoolkit::SchemaCompilerCompilationMode::Optimized);
} catch (const sourcemeta::jsontoolkit::SchemaReferenceError &error) {
if (error.location().empty() && error.id() == schema_uri.recompose()) {
std::cout << "\n";
Expand Down
3 changes: 2 additions & 1 deletion src/command_validate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ auto sourcemeta::jsonschema::cli::validate(
const auto benchmark{options.contains("b") || options.contains("benchmark")};
const auto schema_template{sourcemeta::jsontoolkit::compile(
schema, sourcemeta::jsontoolkit::default_schema_walker, custom_resolver,
sourcemeta::jsontoolkit::default_schema_compiler)};
sourcemeta::jsontoolkit::default_schema_compiler,
sourcemeta::jsontoolkit::SchemaCompilerCompilationMode::Optimized)};

bool result{true};

Expand Down
28 changes: 6 additions & 22 deletions test/compile/pass_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ cat << 'EOF' > "$TMP/expected.json"
"type": "instance",
"location": ""
},
"report": true,
"dynamic": false,
"condition": [],
"children": [
{
"category": "internal",
"type": "container",
"category": "logical",
"type": "and",
"value": null,
"schemaResource": "",
"absoluteKeywordLocation": "#/properties",
Expand All @@ -49,6 +50,7 @@ cat << 'EOF' > "$TMP/expected.json"
"type": "instance",
"location": ""
},
"report": false,
"dynamic": false,
"condition": [
{
Expand All @@ -68,6 +70,7 @@ cat << 'EOF' > "$TMP/expected.json"
"type": "instance",
"location": ""
},
"report": false,
"dynamic": false,
"condition": []
}
Expand All @@ -90,26 +93,7 @@ cat << 'EOF' > "$TMP/expected.json"
"type": "instance",
"location": ""
},
"dynamic": false,
"condition": []
},
{
"category": "annotation",
"type": "public",
"value": {
"category": "value",
"type": "json",
"value": "foo"
},
"schemaResource": "",
"absoluteKeywordLocation": "#/properties",
"relativeSchemaLocation": "",
"relativeInstanceLocation": "",
"target": {
"category": "target",
"type": "instance",
"location": ""
},
"report": true,
"dynamic": false,
"condition": []
}
Expand Down
29 changes: 20 additions & 9 deletions test/format_check_single_fail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,26 @@ cat << 'EOF' > "$TMP/schema.json"
}
EOF

"$1" fmt "$TMP/schema.json" --check && CODE="$?" || CODE="$?"

if [ "$CODE" = "0" ]
then
echo "FAIL" 1>&2
exit 1
else
echo "PASS" 1>&2
fi
"$1" fmt "$TMP/schema.json" --check 2>"$TMP/stderr.txt" && CODE="$?" || CODE="$?"
test "$CODE" = "1" || exit 1

cat << EOF > "$TMP/error.txt"
FAIL: $(realpath "$TMP")/schema.json
Got:
{
"type": 1,
"\$schema": "http://json-schema.org/draft-04/schema#"
}
But expected:
{
"\$schema": "http://json-schema.org/draft-04/schema#",
"type": 1
}
EOF

diff "$TMP/stderr.txt" "$TMP/error.txt"

cat << 'EOF' > "$TMP/expected.json"
{
Expand Down
2 changes: 1 addition & 1 deletion vendor/jsontoolkit/CMakeLists.txt

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

2 changes: 1 addition & 1 deletion vendor/jsontoolkit/src/jsonschema/CMakeLists.txt

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

11 changes: 6 additions & 5 deletions vendor/jsontoolkit/src/jsonschema/compile.cc

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

97 changes: 55 additions & 42 deletions vendor/jsontoolkit/src/jsonschema/compile_describe.cc

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

Loading