Files
nixpkgs/pkgs/data/json-schema/tests.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

70 lines
1.9 KiB
Nix

{
json-schema,
lib,
json-schema-catalog-rs,
runCommand,
}:
lib.recurseIntoAttrs {
test-with-json-schema-catalog-rs =
runCommand "json-schema-catalogs-integration-test"
{
nativeBuildInputs = [
json-schema
json-schema-catalog-rs
];
}
''
cat >example.json <<"EOF"
{
"$id": "https://example.com/schemas/integration-test.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Integration Test",
"type": "object",
"oneOf": [
{
"$ref": "http://json-schema.org/draft-07/schema#"
},
{
"$ref": "http://json-schema.org/draft-07/schema#/definitions/yolo"
},
{
"$ref": "./foo.json#/definitions/bar"
}
]
}
EOF
cat >example.json.expected <<"EOF"
{
"$id": "https://example.com/schemas/integration-test.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"oneOf": [
{
"$ref": "file://${
json-schema.internals.groups."JSON Schema"."http://json-schema.org/draft-07/schema#"
}#"
},
{
"$ref": "file://${
json-schema.internals.groups."JSON Schema"."http://json-schema.org/draft-07/schema#"
}#/definitions/yolo"
},
{
"$ref": "./foo.json#/definitions/bar"
}
],
"title": "Integration Test",
"type": "object"
}
EOF
( set -x;
! grep '##' example.json.expected
)
json-schema-catalog replace --verbose example.json > example.json.out
diff -U3 --color=always example.json.expected example.json.out
touch $out
'';
}