Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.

Commit b5747ca

Browse files
committed
test for issue swagger-api#1071
1 parent ada75b6 commit b5747ca

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ public class OpenAPIV3ParserTest {
6565
protected int serverPort = getDynamicPort();
6666
protected WireMockServer wireMockServer;
6767

68+
@Test
69+
public void testIssue1071() {
70+
71+
ParseOptions options = new ParseOptions();
72+
options.setResolve(true);
73+
74+
SwaggerParseResult parseResult = new OpenAPIV3Parser().readLocation("issue-1071.yaml", null, options);
75+
OpenAPI apispec = parseResult.getOpenAPI();
76+
assertNotNull(apispec);
77+
Schema test = apispec.getPaths().get("/mapschema").getGet().getResponses().get("200").getContent().get("application/json").getSchema();
78+
System.out.println(test.getClass());
79+
assertTrue(test instanceof MapSchema);
80+
81+
}
6882

6983
@Test
7084
public void testIssue1039() {
@@ -76,7 +90,7 @@ public void testIssue1039() {
7690
OpenAPI apispec = parseResult.getOpenAPI();
7791
assertNotNull(apispec);
7892
assertEquals(apispec.getPaths().get("/pets").getGet().getParameters().get(0).getSchema().getType(),"array");
79-
93+
8094
}
8195

8296
@Test
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: 1.0.0
4+
title: Swagger Petstore
5+
description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification
6+
termsOfService: http://swagger.io/terms/
7+
contact:
8+
name: Swagger API Team
9+
email: apiteam@swagger.io
10+
url: http://swagger.io
11+
license:
12+
name: Apache 2.0
13+
url: https://www.apache.org/licenses/LICENSE-2.0.html
14+
servers:
15+
- url: http://petstore.swagger.io/api
16+
paths:
17+
'/mapschema':
18+
get:
19+
description: MapSchema
20+
operationId: MapSchema
21+
responses:
22+
'200':
23+
description: Successful response.
24+
content:
25+
application/json:
26+
schema:
27+
type: object
28+
additionalProperties:
29+
type: string

0 commit comments

Comments
 (0)