-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message when compiling a
$ref
inside an unknown keywo…
…rd (#148) Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
vendorpull https://github.com/sourcemeta/vendorpull dea311b5bfb53b6926a4140267959ae334d3ecf4 | ||
noa https://github.com/sourcemeta/noa 7e26abce7a4e31e86a16ef2851702a56773ca527 | ||
jsontoolkit https://github.com/sourcemeta/jsontoolkit 2b44aee9b2be18a03b375c0b1f15c7623db8b922 | ||
jsontoolkit https://github.com/sourcemeta/jsontoolkit e7a8f35b0b85cd87b5fa587b2ae767ed939a0b4d | ||
hydra https://github.com/sourcemeta/hydra 3c53d3fdef79e9ba603d48470a508cc45472a0dc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
TMP="$(mktemp -d)" | ||
clean() { rm -rf "$TMP"; } | ||
trap clean EXIT | ||
|
||
cat << 'EOF' > "$TMP/schema.json" | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"properties": { | ||
"foo": { "$ref": "#/$defs/bar" }, | ||
"baz": { "type": "string" } | ||
}, | ||
"$defs": { | ||
"bar": { | ||
"$ref": "#/properties/baz" | ||
} | ||
} | ||
} | ||
EOF | ||
|
||
"$1" compile "$TMP/schema.json" 2>"$TMP/stderr.txt" \ | ||
&& CODE="$?" || CODE="$?" | ||
test "$CODE" = "1" || exit 1 | ||
|
||
cat << 'EOF' > "$TMP/expected.txt" | ||
error: The schema location is inside of an unknown keyword | ||
#/properties/baz | ||
at schema location "/$defs/bar/$ref" | ||
EOF | ||
|
||
diff "$TMP/stderr.txt" "$TMP/expected.txt" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.