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 1
1
[
2
2
{
3
+ "description" : " remote ref" ,
3
4
"schema" : {
4
5
"$ref" : " http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
5
6
},
15
16
"valid" : false
16
17
}
17
18
]
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
+ ]
18
77
}
19
78
]
Original file line number Diff line number Diff line change 159
159
]
160
160
},
161
161
{
162
+ "description" : " remote reference with url fragment" ,
162
163
"schema" : {
163
164
"$ref" : " http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
164
165
},
Original file line number Diff line number Diff line change 3
3
namespace Swaggest \JsonSchema \Tests \PHPUnit \ClassStructure ;
4
4
5
5
6
+ use Swaggest \JsonSchema \Context ;
7
+ use Swaggest \JsonSchema \RemoteRef \Preloaded ;
6
8
use Swaggest \JsonSchema \Schema ;
7
9
use Swaggest \JsonSchema \Tests \Helper \DbId ;
8
10
use Swaggest \JsonSchema \Tests \Helper \DeepRefRoot ;
@@ -125,7 +127,7 @@ public function testDeepRefSchema()
125
127
JSON;
126
128
$ schemaData = json_decode ($ schemaJson );
127
129
128
- $ schema = Schema::import ($ schemaData );
130
+ $ schema = Schema::import ($ schemaData, new Context ( new Preloaded ()) );
129
131
$ exported = Schema::export ($ schema );
130
132
$ this ->assertSame ($ schemaJson , json_encode ($ exported , JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ));
131
133
}
You can’t perform that action at this time.
0 commit comments