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 e86ad1e3 #163

Merged
merged 1 commit into from
Sep 21, 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 6c78f131029c647be79cc5da5874fa8d50415cde
jsontoolkit https://github.com/sourcemeta/jsontoolkit e86ad1e333c11b6fc2659a0f32ae883ef1040e20
hydra https://github.com/sourcemeta/hydra 3c53d3fdef79e9ba603d48470a508cc45472a0dc
alterschema https://github.com/sourcemeta/alterschema a31722f04ae2d7e57f2fe5bbb0613670866c0840
6 changes: 2 additions & 4 deletions src/command_bundle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ auto sourcemeta::jsonschema::cli::bundle(
sourcemeta::jsontoolkit::bundle(
schema, sourcemeta::jsontoolkit::default_schema_walker,
resolver(options, options.contains("h") || options.contains("http")),
sourcemeta::jsontoolkit::BundleOptions::WithoutIdentifiers)
.wait();
sourcemeta::jsontoolkit::BundleOptions::WithoutIdentifiers);
} else {
sourcemeta::jsontoolkit::bundle(
schema, sourcemeta::jsontoolkit::default_schema_walker,
resolver(options, options.contains("h") || options.contains("http")),
sourcemeta::jsontoolkit::BundleOptions::Default)
.wait();
sourcemeta::jsontoolkit::BundleOptions::Default);
}

sourcemeta::jsontoolkit::prettify(
Expand Down
6 changes: 4 additions & 2 deletions src/command_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ auto sourcemeta::jsonschema::cli::test(
schema.value(), sourcemeta::jsontoolkit::default_schema_walker,
test_resolver, sourcemeta::jsontoolkit::default_schema_compiler);
} catch (const sourcemeta::jsontoolkit::SchemaReferenceError &error) {
if (error.location().empty() && error.id() == schema_uri.recompose()) {
if (error.location() == sourcemeta::jsontoolkit::Pointer{"$ref"} &&
error.id() == schema_uri.recompose()) {
std::cout << "\n";
throw sourcemeta::jsontoolkit::SchemaResolutionError(
test.at("target").to_string(),
Expand Down Expand Up @@ -237,8 +238,9 @@ auto sourcemeta::jsonschema::cli::test(
return EXIT_FAILURE;
}

const std::string ref{"$ref"};
sourcemeta::jsontoolkit::SchemaCompilerErrorTraceOutput output{
schema.value(), {"$ref"}};
schema.value(), {std::cref(ref)}};
const auto case_result{sourcemeta::jsontoolkit::evaluate(
schema_template,
get_data(test_case, entry.first.parent_path(), verbose),
Expand Down
48 changes: 8 additions & 40 deletions test/compile/pass_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,19 @@ EOF
cat << 'EOF' > "$TMP/expected.json"
[
{
"category": "loop",
"type": "properties-match",
"category": "assertion",
"type": "property-type-strict",
"value": {
"category": "value",
"type": "named-indexes",
"value": {
"foo": 0
}
"type": "type",
"value": "string"
},
"schemaResource": "",
"absoluteKeywordLocation": "#/properties",
"relativeSchemaLocation": "/properties",
"relativeInstanceLocation": "",
"absoluteKeywordLocation": "#/properties/foo/type",
"relativeSchemaLocation": "/properties/foo/type",
"relativeInstanceLocation": "/foo",
"report": true,
"dynamic": false,
"children": [
{
"category": "logical",
"type": "and",
"value": null,
"schemaResource": "",
"absoluteKeywordLocation": "#/properties",
"relativeSchemaLocation": "",
"relativeInstanceLocation": "",
"report": false,
"dynamic": false,
"children": [
{
"category": "assertion",
"type": "type-strict",
"value": {
"category": "value",
"type": "type",
"value": "string"
},
"schemaResource": "",
"absoluteKeywordLocation": "#/properties/foo/type",
"relativeSchemaLocation": "/foo/type",
"relativeInstanceLocation": "/foo",
"report": true,
"dynamic": false
}
]
}
]
"dynamic": false
}
]
EOF
Expand Down
3 changes: 0 additions & 3 deletions test/metaschema/fail_directory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ error: Schema validation failure
The string value "object" was expected to equal one of the following values: "array", "boolean", "integer", "null", "number", "object", and "string"
at instance location "/type"
at evaluate path "/properties/type/anyOf/0/\$ref/enum"
The string value was expected to validate against the statically referenced schema
at instance location "/type"
at evaluate path "/properties/type/anyOf/0/\$ref"
The value was expected to be of type array but it was of type string
at instance location "/type"
at evaluate path "/properties/type/anyOf/1/type"
Expand Down
3 changes: 0 additions & 3 deletions test/metaschema/fail_single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ error: Schema validation failure
The string value "object" was expected to equal one of the following values: "array", "boolean", "integer", "null", "number", "object", and "string"
at instance location "/type"
at evaluate path "/properties/type/anyOf/0/\$ref/enum"
The string value was expected to validate against the statically referenced schema
at instance location "/type"
at evaluate path "/properties/type/anyOf/0/\$ref"
The value was expected to be of type array but it was of type string
at instance location "/type"
at evaluate path "/properties/type/anyOf/1/type"
Expand Down
3 changes: 0 additions & 3 deletions test/validate/fail_draft4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ error: Schema validation failure
The value was expected to be of type string but it was of type integer
at instance location "/foo"
at evaluate path "/properties/foo/type"
The object value was expected to validate against the single defined property subschema
at instance location ""
at evaluate path "/properties"
EOF

diff "$TMP/stderr.txt" "$TMP/expected.txt"
3 changes: 0 additions & 3 deletions test/validate/fail_draft6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ error: Schema validation failure
The value was expected to be of type string but it was of type integer
at instance location "/foo"
at evaluate path "/properties/foo/type"
The object value was expected to validate against the single defined property subschema
at instance location ""
at evaluate path "/properties"
EOF

diff "$TMP/stderr.txt" "$TMP/expected.txt"
3 changes: 0 additions & 3 deletions test/validate/fail_draft7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ error: Schema validation failure
The value was expected to be of type string but it was of type integer
at instance location "/foo"
at evaluate path "/properties/foo/type"
The object value was expected to validate against the single defined property subschema
at instance location ""
at evaluate path "/properties"
EOF

diff "$TMP/stderr.txt" "$TMP/expected.txt"
3 changes: 0 additions & 3 deletions test/validate/fail_many.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ error: Schema validation failure
The value was expected to be of type string but it was of type integer
at instance location "/foo"
at evaluate path "/properties/foo/type"
The object value was expected to validate against the single defined property subschema
at instance location ""
at evaluate path "/properties"
EOF

diff "$TMP/stderr.txt" "$TMP/expected.txt"
3 changes: 0 additions & 3 deletions test/validate/fail_many_verbose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ error: Schema validation failure
The value was expected to be of type string but it was of type integer
at instance location "/foo"
at evaluate path "/properties/foo/type"
The object value was expected to validate against the single defined property subschema
at instance location ""
at evaluate path "/properties"
ok: $(realpath "$TMP")/instance_3.json
matches $(realpath "$TMP")/schema.json
EOF
Expand Down

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

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

Loading