at master 69 lines 1.9 kB view raw
1{ 2 json-schema, 3 lib, 4 json-schema-catalog-rs, 5 runCommand, 6}: 7 8lib.recurseIntoAttrs { 9 test-with-json-schema-catalog-rs = 10 runCommand "json-schema-catalogs-integration-test" 11 { 12 nativeBuildInputs = [ 13 json-schema 14 json-schema-catalog-rs 15 ]; 16 } 17 '' 18 cat >example.json <<"EOF" 19 { 20 "$id": "https://example.com/schemas/integration-test.json", 21 "$schema": "http://json-schema.org/draft-07/schema#", 22 "title": "Integration Test", 23 "type": "object", 24 "oneOf": [ 25 { 26 "$ref": "http://json-schema.org/draft-07/schema#" 27 }, 28 { 29 "$ref": "http://json-schema.org/draft-07/schema#/definitions/yolo" 30 }, 31 { 32 "$ref": "./foo.json#/definitions/bar" 33 } 34 ] 35 } 36 EOF 37 cat >example.json.expected <<"EOF" 38 { 39 "$id": "https://example.com/schemas/integration-test.json", 40 "$schema": "http://json-schema.org/draft-07/schema#", 41 "oneOf": [ 42 { 43 "$ref": "file://${ 44 json-schema.internals.groups."JSON Schema"."http://json-schema.org/draft-07/schema#" 45 }#" 46 }, 47 { 48 "$ref": "file://${ 49 json-schema.internals.groups."JSON Schema"."http://json-schema.org/draft-07/schema#" 50 }#/definitions/yolo" 51 }, 52 { 53 "$ref": "./foo.json#/definitions/bar" 54 } 55 ], 56 "title": "Integration Test", 57 "type": "object" 58 } 59 EOF 60 ( set -x; 61 ! grep '##' example.json.expected 62 ) 63 64 json-schema-catalog replace --verbose example.json > example.json.out 65 66 diff -U3 --color=always example.json.expected example.json.out 67 touch $out 68 ''; 69}