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
20 changes: 4 additions & 16 deletions src/command_validate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ auto process_entry(const sourcemeta::jsonschema::InputJSON &entry,
const sourcemeta::blaze::Template &schema_template,
bool benchmark, std::uint64_t benchmark_loop, bool trace,
bool fast_mode, bool json_output, bool continue_on_error,
const std::filesystem::path &schema_display_path,
const sourcemeta::core::Options &options,
sourcemeta::jsonschema::ValidationSummary &summary) -> bool {
sourcemeta::blaze::SimpleOutput output{entry.second};
Expand Down Expand Up @@ -214,10 +213,7 @@ auto process_entry(const sourcemeta::jsonschema::InputJSON &entry,
sourcemeta::jsonschema::LOG_VERBOSE(options)
<< " (entry #" << entry.index + 1 << ")";
}
sourcemeta::jsonschema::LOG_VERBOSE(options)
<< "\n matches "
<< sourcemeta::jsonschema::relative_path_string(schema_display_path)
<< "\n";
sourcemeta::jsonschema::LOG_VERBOSE(options) << "\n";
} else {
if (continue_on_error && entry.multidocument && summary.failed > 0) {
std::cerr << "\n";
Expand Down Expand Up @@ -270,10 +266,6 @@ auto sourcemeta::jsonschema::validate(const sourcemeta::core::Options &options)
: std::filesystem::path(schema_path)};
const auto schema_resolution_base{
schema_from_stdin ? stdin_path() : std::filesystem::path(schema_path)};
const auto schema_display_path{
schema_from_stdin
? stdin_path()
: sourcemeta::core::weakly_canonical(schema_resolution_base)};

const auto configuration_path{
find_configuration(options, schema_config_base)};
Expand Down Expand Up @@ -386,8 +378,7 @@ auto sourcemeta::jsonschema::validate(const sourcemeta::core::Options &options)
for (auto entry{entries.cbegin()}; entry != entries.cend(); ++entry) {
if (!process_entry(*entry, evaluator, schema_template, benchmark,
benchmark_loop, trace, fast_mode, json_output,
continue_on_error, schema_display_path, options,
summary)) {
continue_on_error, options, summary)) {
summary.stopped = std::next(entry) != entries.cend();
break;
}
Expand Down Expand Up @@ -426,8 +417,7 @@ auto sourcemeta::jsonschema::validate(const sourcemeta::core::Options &options)
for (auto entry{entries.cbegin()}; entry != entries.cend(); ++entry) {
if (!process_entry(*entry, evaluator, schema_template, benchmark,
benchmark_loop, trace, fast_mode, json_output,
continue_on_error, schema_display_path, options,
summary)) {
continue_on_error, options, summary)) {
summary.stopped = std::next(entry) != entries.cend();
proceed = false;
break;
Expand Down Expand Up @@ -490,9 +480,7 @@ auto sourcemeta::jsonschema::validate(const sourcemeta::core::Options &options)
std::cout << "\n";
} else if (subresult) {
LOG_VERBOSE(options)
<< "ok: " << relative_path_string(instance_display_path)
<< "\n matches " << relative_path_string(schema_display_path)
<< "\n";
<< "ok: " << relative_path_string(instance_display_path) << "\n";
} else {
std::cerr << "fail: " << relative_path_string(instance_display_path)
<< "\n";
Expand Down
1 change: 0 additions & 1 deletion test/ci/pass_validate_fuse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ bindfs --no-allow-other "$TMP" "$FUSE_MOUNT"

cat << 'EOF' > "$TMP/expected.txt"
ok: instance.json
matches level1/level2/level3/schema.json

1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_directory_continue_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ WRITE expected_0.txt UNTIL EOF
2> at instance location "" (line 1, column 1)
2> at evaluate path "/properties"
2> ok: instances/instance_2.json
2> matches schema.json
2>
2> 2 validated, 1 passed, 1 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_directory_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ RUN validate schema.json instances --verbose STDIN /dev/null IN . INTO result_0.

WRITE expected_0.txt UNTIL EOF
2> ok: instances/instance_1.json
2> matches schema.json
2> fail: instances/nested/instance_2.json
2> error: Schema validation failure
2> The value was expected to be of type integer but it was of type string
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_jsonl_continue_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as JSONL: [CWD]/instance.jsonl
2> ok: instance.jsonl (entry #1)
2> matches schema.json
2> fail: instance.jsonl (entry #2)
2>
2> [
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_jsonl_gz_one_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as GZIP-compressed JSONL: [CWD]/instance.jsonl.gz
2> ok: instance.jsonl.gz (entry #1)
2> matches schema.json
2> fail: instance.jsonl.gz (entry #2)
2>
2> [
Expand Down
2 changes: 0 additions & 2 deletions test/validate/fail_jsonl_one_continue_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as JSONL: [CWD]/instance.jsonl
2> ok: instance.jsonl (entry #1)
2> matches schema.json
2> fail: instance.jsonl (entry #2)
2>
2> [
Expand All @@ -36,7 +35,6 @@ WRITE expected_0.txt UNTIL EOF
2> at evaluate path "/type"
2>
2> ok: instance.jsonl (entry #3)
2> matches schema.json
2>
2> 3 validated, 2 passed, 1 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_jsonl_one_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as JSONL: [CWD]/instance.jsonl
2> ok: instance.jsonl (entry #1)
2> matches schema.json
2> fail: instance.jsonl (entry #2)
2>
2> [
Expand Down
2 changes: 0 additions & 2 deletions test/validate/fail_many_continue_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ RUN validate schema.json instance_1.json instance_2.json instance_3.json --conti

WRITE expected_0.txt UNTIL EOF
2> ok: instance_1.json
2> matches schema.json
2> fail: instance_2.json
2> error: Schema validation failure
2> The value was expected to be of type string but it was of type integer
Expand All @@ -39,7 +38,6 @@ WRITE expected_0.txt UNTIL EOF
2> at instance location "" (line 1, column 1)
2> at evaluate path "/properties"
2> ok: instance_3.json
2> matches schema.json
2>
2> 3 validated, 2 passed, 1 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_many_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ RUN validate schema.json instance_1.json instance_2.json instance_3.json --verbo

WRITE expected_0.txt UNTIL EOF
2> ok: instance_1.json
2> matches schema.json
2> fail: instance_2.json
2> error: Schema validation failure
2> The value was expected to be of type string but it was of type integer
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_yaml_multi_blank_lines.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as YAML multi-document: [CWD]/instance.yaml
2> ok: instance.yaml (entry #1)
2> matches schema.json
2> fail: instance.yaml (entry #2)
2>
2> [
Expand Down
1 change: 0 additions & 1 deletion test/validate/fail_yaml_multi_one_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as YAML multi-document: [CWD]/instance.yaml
2> ok: instance.yaml (entry #1)
2> matches schema.json
2> fail: instance.yaml (entry #2)
2>
2> [
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_2020_12_default_dialect_config.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ RUN validate --verbose $CWD/schema.json $CWD/instance.json STDIN /dev/null IN .

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ RUN validate --verbose level1/level2/level3/schema.json instance.json STDIN /dev

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches level1/level2/level3/schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ RUN validate --verbose schema.json instance.json STDIN /dev/null IN . INTO resul

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_2020_12_format_assertion.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RUN validate schema.json instance.json --resolve metaschema.json --verbose STDIN

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RUN validate schema.json instance.json --resolve metaschema.json --verbose STDIN

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_config_ignore_with_cli.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ WRITE expected_0.txt UNTIL EOF
2> Using extension: .yaml
2> Using extension: .yml
2> ok: instances/valid.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_configuration_option.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Using configuration file: [CWD]/config/jsonschema.json
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Using configuration file: [CWD]/jsonschema.ci.json
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_configuration_option_directory.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Using configuration file: [CWD]/config/jsonschema.json
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Using configuration file: [CWD]/config/jsonschema.json
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_configuration_option_short.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Using configuration file: [CWD]/config/jsonschema.json
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
3 changes: 0 additions & 3 deletions test/validate/pass_cwd.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ REPLACE $CWD WITH '[CWD]' IN result.txt
WRITE expected.txt UNTIL EOF
2> warning: Recursively processing every file in [CWD] as no input was provided
2> ok: instance_1.json
2> matches schema.json
2> ok: instance_2.json
2> matches schema.json
2> ok: schema.json
2> matches schema.json
2>
2> 3 validated, 3 passed, 0 failed
EOF
Expand Down
2 changes: 0 additions & 2 deletions test/validate/pass_cwd_config_no_path.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ WRITE expected.txt UNTIL EOF
2> Using extension: .yaml
2> Using extension: .yml
2> ok: instance.json
2> matches schema.json
2> ok: schema.json
2> matches schema.json
2>
2> 2 validated, 2 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_default_dialect_cli_relative.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ RUN validate schema.json instance.json --default-dialect ../meta.json --verbose

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
2 changes: 0 additions & 2 deletions test/validate/pass_directory_extension_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ RUN validate schema.json instances --extension .data.json --verbose STDIN /dev/n
WRITE expected_0.txt UNTIL EOF
2> Using extension: .data.json
2> ok: instances/instance_1.data.json
2> matches schema.json
2> ok: instances/instance_2.data.json
2> matches schema.json
2>
2> 2 validated, 2 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_directory_ignore_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Ignoring path: "[CWD]/instances/drafts"
2> ok: instances/instance_1.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
2 changes: 0 additions & 2 deletions test/validate/pass_directory_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ RUN validate schema.json instances --verbose STDIN /dev/null IN . INTO result_0.

WRITE expected_0.txt UNTIL EOF
2> ok: instances/instance_1.json
2> matches schema.json
2> ok: instances/instance_2.json
2> matches schema.json
2>
2> 2 validated, 2 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_entrypoint_pointer.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN validate schema.json instance.json --entrypoint /\$$defs/PositiveInt --verbo

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_entrypoint_pointer_fragment.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN validate schema.json instance.json --entrypoint #/\$$defs/PositiveInt --verb

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN validate schema.json instance.json --entrypoint '#/$$defs/Positive Int' --ve

WRITE expected.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_entrypoint_pointer_space.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUN validate schema.json instance.json --entrypoint '/$$defs/Positive Int' --ver

WRITE expected.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
1 change: 0 additions & 1 deletion test/validate/pass_entrypoint_uri.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ RUN validate schema.json instance.json --entrypoint https://example.com/schema#/

WRITE expected_0.txt UNTIL EOF
2> ok: instance.json
2> matches schema.json
2>
2> 1 validated, 1 passed, 0 failed
EOF
Expand Down
2 changes: 0 additions & 2 deletions test/validate/pass_extension_empty_json.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ RUN validate schema.json instances --extension '' --verbose STDIN /dev/null IN .
WRITE expected_0.txt UNTIL EOF
2> warning: Matching files with no extension
2> ok: instances/instance1
2> matches schema.json
2> ok: instances/instance2
2> matches schema.json
2>
2> 2 validated, 2 passed, 0 failed
EOF
Expand Down
2 changes: 0 additions & 2 deletions test/validate/pass_extension_empty_yaml.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ RUN validate schema.json instances --extension '' --verbose STDIN /dev/null IN .
WRITE expected_0.txt UNTIL EOF
2> warning: Matching files with no extension
2> ok: instances/instance1
2> matches schema.json
2> ok: instances/instance2
2> matches schema.json
2>
2> 2 validated, 2 passed, 0 failed
EOF
Expand Down
3 changes: 0 additions & 3 deletions test/validate/pass_jsonl_gz_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as GZIP-compressed JSONL: [CWD]/instance.jsonl.gz
2> ok: instance.jsonl.gz (entry #1)
2> matches schema.json
2> ok: instance.jsonl.gz (entry #2)
2> matches schema.json
2> ok: instance.jsonl.gz (entry #3)
2> matches schema.json
2>
2> 3 validated, 3 passed, 0 failed
EOF
Expand Down
3 changes: 0 additions & 3 deletions test/validate/pass_jsonl_verbose.clitest
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ REPLACE $CWD WITH '[CWD]' IN result_0.txt
WRITE expected_0.txt UNTIL EOF
2> Interpreting input as JSONL: [CWD]/instance.jsonl
2> ok: instance.jsonl (entry #1)
2> matches schema.json
2> ok: instance.jsonl (entry #2)
2> matches schema.json
2> ok: instance.jsonl (entry #3)
2> matches schema.json
2>
2> 3 validated, 3 passed, 0 failed
EOF
Expand Down
Loading
Loading