Skip to content

Commit 98d0465

Browse files
Test case for unresolved references while instantiating Encoding
Test case for unresolved references while instantiating Encoding
1 parent aafedb5 commit 98d0465

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/spec/OpenApiTest.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,54 @@ public function testSpecs($openApiFile)
239239
}
240240

241241
}
242+
243+
public function testUnresolvedReferencesInEncoding($config, $expectedException)
244+
{
245+
$yaml = Yaml::parse(<<<'YAML'
246+
openapi: "3.0.0"
247+
info:
248+
version: 1.0.0
249+
title: Encoding test
250+
paths:
251+
/pets:
252+
post:
253+
summary: Create a pet
254+
operationId: createPets
255+
requestBody:
256+
content:
257+
multipart/form-data:
258+
schema:
259+
type: object
260+
properties:
261+
pet:
262+
$ref: '#/components/schemas/Pet'
263+
petImage:
264+
type: string
265+
format: binary
266+
encoding:
267+
pet:
268+
contentType: application/json
269+
petImage:
270+
contentType: image/*
271+
application/json:
272+
schema:
273+
$ref: '#/components/schemas/Pet'
274+
responses:
275+
'201':
276+
description: Null response
277+
components:
278+
schemas:
279+
Pet:
280+
type: object
281+
properties:
282+
name:
283+
type: string
284+
YAML
285+
);
286+
$openapi = new OpenApi($yaml);
287+
$result = $openapi->validate();
288+
289+
$this->assertEquals([], $openapi->getErrors());
290+
$this->assertTrue($result);
291+
}
242292
}

0 commit comments

Comments
 (0)