File tree Expand file tree Collapse file tree 3 files changed +63
-1
lines changed
src/PHPUnit/ClassStructure Expand file tree Collapse file tree 3 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 11[
22 {
3+ "description" : " remote ref" ,
34 "schema" : {
45 "$ref" : " http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
56 },
1516 "valid" : false
1617 }
1718 ]
19+ },
20+ {
21+ "description" : " enum-terminated self-reference" ,
22+ "schema" : {
23+ "anyOf" : [
24+ {
25+ "$ref" : " #/definitions/Foo"
26+ }
27+ ],
28+ "definitions" : {
29+ "Foo" : {
30+ "oneOf" : [
31+ {
32+ "enum" : [
33+ " A" ,
34+ " B"
35+ ]
36+ },
37+ {
38+ "type" : " object" ,
39+ "additionalProperties" : {
40+ "$ref" : " #/definitions/Foo"
41+ }
42+ }
43+ ]
44+ }
45+ }
46+ },
47+ "tests" : [
48+ {
49+ "description" : " valid against enum" ,
50+ "data" : {
51+ "test" : " A" ,
52+ "test1" : " B" ,
53+ "test2" : {
54+ "test4" : " A" ,
55+ "test5" : {
56+ "test6" : " B"
57+ }
58+ }
59+ },
60+ "valid" : true
61+ },
62+ {
63+ "description" : " invalid against enum" ,
64+ "data" : {
65+ "test" : " A" ,
66+ "test1" : " B" ,
67+ "test2" : {
68+ "test4" : " A" ,
69+ "test5" : {
70+ "test6" : " C"
71+ }
72+ }
73+ },
74+ "valid" : false
75+ }
76+ ]
1877 }
1978]
Original file line number Diff line number Diff line change 159159 ]
160160 },
161161 {
162+ "description" : " remote reference with url fragment" ,
162163 "schema" : {
163164 "$ref" : " http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
164165 },
Original file line number Diff line number Diff line change 33namespace Swaggest \JsonSchema \Tests \PHPUnit \ClassStructure ;
44
55
6+ use Swaggest \JsonSchema \Context ;
7+ use Swaggest \JsonSchema \RemoteRef \Preloaded ;
68use Swaggest \JsonSchema \Schema ;
79use Swaggest \JsonSchema \Tests \Helper \DbId ;
810use Swaggest \JsonSchema \Tests \Helper \DeepRefRoot ;
@@ -125,7 +127,7 @@ public function testDeepRefSchema()
125127JSON;
126128 $ schemaData = json_decode ($ schemaJson );
127129
128- $ schema = Schema::import ($ schemaData );
130+ $ schema = Schema::import ($ schemaData, new Context ( new Preloaded ()) );
129131 $ exported = Schema::export ($ schema );
130132 $ this ->assertSame ($ schemaJson , json_encode ($ exported , JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ));
131133 }
You can’t perform that action at this time.
0 commit comments