File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -174,4 +174,74 @@ public function testRefClass()
174
174
);
175
175
}
176
176
177
+ /**
178
+ * @throws \Swaggest\JsonSchema\Exception
179
+ * @throws \Swaggest\JsonSchema\InvalidValue
180
+ * @see https://github.com/swaggest/php-json-schema/issues/51
181
+ */
182
+ public function testJustADereferencer ()
183
+ {
184
+ $ schema = \Swaggest \JsonSchema \Schema::import (json_decode (<<<'JSON'
185
+ {
186
+ "type": "object",
187
+ "properties": {
188
+ "id": {
189
+ "type": "integer"
190
+ },
191
+ "orders": {
192
+ "type": "array",
193
+ "items": {
194
+ "$ref": "#/definitions/order"
195
+ }
196
+ }
197
+ },
198
+ "definitions": {
199
+ "order": {
200
+ "type": "object",
201
+ "properties": {
202
+ "orderid": {
203
+ "type": "integer"
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ JSON
210
+ ));
211
+
212
+ $ dereferencedJson = json_encode ($ schema , JSON_PRETTY_PRINT );
213
+ $ this ->assertSame (<<<'JSON'
214
+ {
215
+ "definitions": {
216
+ "order": {
217
+ "properties": {
218
+ "orderid": {
219
+ "type": "integer"
220
+ }
221
+ },
222
+ "type": "object"
223
+ }
224
+ },
225
+ "properties": {
226
+ "id": {
227
+ "type": "integer"
228
+ },
229
+ "orders": {
230
+ "items": {
231
+ "properties": {
232
+ "orderid": {
233
+ "type": "integer"
234
+ }
235
+ },
236
+ "type": "object"
237
+ },
238
+ "type": "array"
239
+ }
240
+ },
241
+ "type": "object"
242
+ }
243
+ JSON
244
+ , $ dereferencedJson
245
+ );
246
+ }
177
247
}
You can’t perform that action at this time.
0 commit comments