File tree Expand file tree Collapse file tree 1 file changed +30
-4
lines changed
Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,35 @@ cat << 'EOF' > "$TMP/instance.json"
2929EOF
3030
3131" $1 " validate " $TMP /document.json" " $TMP /instance.json" \
32- --path " /components/schemas/User" \
33- > /dev/null 2>&1 \
32+ --path " /components/schemas/User" 2> " $TMP /stderr.txt" \
3433 && EXIT_CODE=" $? " || EXIT_CODE=" $? "
35- # Validation should fail when $ref points outside extracted subtree
36- test " $EXIT_CODE " -ne " 0"
34+ # Schema input error: $ref outside extracted subtree cannot be resolved during bundling
35+ test " $EXIT_CODE " = " 4"
36+
37+ cat << EOF > "$TMP /expected.txt"
38+ error: Could not resolve schema reference
39+ at identifier file://$( realpath " $TMP " ) /document.json#/components/schemas/Address
40+ at file path $( realpath " $TMP " ) /document.json
41+ at location "/\$ ref"
42+ EOF
43+
44+ diff " $TMP /stderr.txt" " $TMP /expected.txt"
45+
46+ # JSON error
47+ " $1 " validate " $TMP /document.json" " $TMP /instance.json" \
48+ --path " /components/schemas/User" --json > " $TMP /stdout.txt" \
49+ && EXIT_CODE=" $? " || EXIT_CODE=" $? "
50+ # Schema input error
51+ test " $EXIT_CODE " = " 4"
52+
53+ cat << EOF > "$TMP /expected.txt"
54+ {
55+ "error": "Could not resolve schema reference",
56+ "identifier": "file://$( realpath " $TMP " ) /document.json#/components/schemas/Address",
57+ "filePath": "$( realpath " $TMP " ) /document.json",
58+ "location": "/\$ ref"
59+ }
60+ EOF
61+
62+ diff " $TMP /stdout.txt" " $TMP /expected.txt"
3763
You can’t perform that action at this time.
0 commit comments