-
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.
Print nicer messages when encountering JSON parsing errors (#88)
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
9 changed files
with
94 additions
and
6 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 2bc3138b80e575786bec418c91fc2058c6836993 | ||
jsontoolkit https://github.com/sourcemeta/jsontoolkit 37580da97c6549cd5995b3ef62ad47892246ebfd | ||
jsontoolkit https://github.com/sourcemeta/jsontoolkit 1d291fc26bae59e778067e5dfa54096a1fb608f3 | ||
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
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,31 @@ | ||
#!/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-04/schema#" | ||
"type" 1, | ||
} | ||
EOF | ||
|
||
"$1" fmt "$TMP/schema.json" --check 2>"$TMP/output.txt" && CODE="$?" || CODE="$?" | ||
|
||
if [ "$CODE" = "0" ] | ||
then | ||
echo "FAIL" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
cat << EOF > "$TMP/expected.txt" | ||
$(realpath "$TMP/schema.json") | ||
Failed to parse the JSON document at line 3 and column 3 | ||
EOF | ||
|
||
diff "$TMP/output.txt" "$TMP/expected.txt" | ||
echo "PASS" 1>&2 |
27 changes: 23 additions & 4 deletions
27
vendor/jsontoolkit/src/json/include/sourcemeta/jsontoolkit/json_error.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
vendor/jsontoolkit/src/uri/include/sourcemeta/jsontoolkit/uri.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.