Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test compiling schemas with $ref #146

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ add_jsonschema_test_unix(frame/fail_schema_invalid_json)
add_jsonschema_test_unix(frame/fail_unknown_metaschema)

# Compile
add_jsonschema_test_unix(compile/pass)
add_jsonschema_test_unix(compile/pass_1)
add_jsonschema_test_unix(compile/pass_2)
add_jsonschema_test_unix(compile/fail_no_schema)
add_jsonschema_test_unix(compile/fail_schema_invalid_json)
add_jsonschema_test_unix(compile/fail_unknown_metaschema)
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions test/compile/pass_2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/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#",
"allOf": [ {"$ref": "#/definitions/job" } ],
"definitions": { "job": {} }
}
EOF

# We cannot assert on the result as the reference generates a random label
"$1" compile "$TMP/schema.json"