1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
{
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
'';
}
|