Skip to content

Commit

Permalink
[WIP] Gracefully handle validating empty JSONL datasets
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Aug 20, 2024
1 parent 6ffc926 commit 6e9296c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ add_jsonschema_test_unix(validate/fail_draft7)
add_jsonschema_test_unix(validate/fail_2019_09)
add_jsonschema_test_unix(validate/fail_2020_12)
add_jsonschema_test_unix(validate/pass_jsonl)
add_jsonschema_test_unix(validate/pass_jsonl_empty)
add_jsonschema_test_unix(validate/pass_jsonl_verbose)
add_jsonschema_test_unix(validate/fail_jsonl_invalid_entry)
add_jsonschema_test_unix(validate/fail_jsonl_one)
Expand Down
22 changes: 22 additions & 0 deletions test/validate/pass_jsonl_empty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/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#",
"properties": {
"foo": {
"type": "string"
}
}
}
EOF

touch "$TMP/instance.jsonl"
"$1" validate "$TMP/schema.json" "$TMP/instance.jsonl"

0 comments on commit 6e9296c

Please sign in to comment.