File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ add_jsonschema_test_unix(test/fail_not_object)
116116add_jsonschema_test_unix(test /fail_no_schema)
117117add_jsonschema_test_unix(test /fail_schema_non_string)
118118add_jsonschema_test_unix(test /fail_no_tests)
119+ add_jsonschema_test_unix(test /fail_anyof)
119120add_jsonschema_test_unix(test /fail_tests_non_array)
120121add_jsonschema_test_unix(test /fail_test_case_non_object)
121122add_jsonschema_test_unix(test /fail_test_case_no_data)
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -o errexit
4+ set -o nounset
5+
6+ TMP=" $( mktemp -d) "
7+ clean () { rm -rf " $TMP " ; }
8+ trap clean EXIT
9+
10+ cat << 'EOF ' > "$TMP/schema.json"
11+ {
12+ "id": "https://example.com",
13+ "$schema": "http://json-schema.org/draft-04/schema#",
14+ "allOf": [
15+ {
16+ "anyOf": [
17+ { "required": [ "foo" ] },
18+ { "required": [ "bar" ] }
19+ ]
20+ },
21+ {
22+ "type": "integer"
23+ }
24+ ]
25+ }
26+ EOF
27+
28+ cat << 'EOF ' > "$TMP/test.json"
29+ {
30+ "target": "https://example.com",
31+ "tests": [
32+ {
33+ "valid": true,
34+ "data": { "bar": 1 }
35+ }
36+ ]
37+ }
38+ EOF
39+
40+ " $1 " test " $TMP /test.json" --resolve " $TMP /schema.json" 1> " $TMP /output.txt" 2>&1 \
41+ && CODE=" $? " || CODE=" $? "
42+ test " $CODE " = " 1" || exit 1
43+
44+ cat " $TMP /output.txt"
45+
46+ cat << EOF > "$TMP /expected.txt"
47+ $( realpath " $TMP " ) /test.json:
48+ 1/1 FAIL <no description>
49+
50+ error: Schema validation failure
51+ The value was expected to be of type integer but it was of type object
52+ at instance location ""
53+ at evaluate path "/allOf/1/type"
54+ EOF
55+
56+ diff " $TMP /output.txt" " $TMP /expected.txt"
You can’t perform that action at this time.
0 commit comments