Skip to content

Commit 325b76d

Browse files
committed
added test to verify issue solved
1 parent cc0795f commit 325b76d

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/util/InlineModelResolverTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,4 +1337,17 @@ public void testArbitraryObjectModelWithArrayInlineWithTitle() {
13371337
ObjectSchema op = (ObjectSchema) inlineProp;
13381338
assertNull(op.getProperties());
13391339
}
1340-
}
1340+
1341+
1342+
@Test(description = "https://github.com/swagger-api/swagger-parser/issues/1200")
1343+
public void testInlineItemsSchema() throws Exception {
1344+
ParseOptions options = new ParseOptions();
1345+
options.setFlatten(true);
1346+
OpenAPI openAPI = new OpenAPIV3Parser().read("flatten.json",null, options);
1347+
1348+
System.out.println(openAPI);
1349+
1350+
assertNotNull(openAPI);
1351+
assertNotNull(openAPI.getComponents().getSchemas().get("inline_response_200"));
1352+
}
1353+
}

modules/swagger-parser-v3/src/test/resources/flatten.json

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
{
22
"openapi" : "3.0.1",
3+
"paths" : {
4+
"/employees" : {
5+
"get" : {
6+
"description" : "Obtain information about employees from HR database",
7+
"parameters" : [ {
8+
"name" : "bodylimit",
9+
"in" : "query",
10+
"schema" : {
11+
"type" : "integer",
12+
"minimum" : 10,
13+
"maximum" : 20,
14+
"example" : 8
15+
}
16+
}, {
17+
"name" : "pagelimit",
18+
"in" : "query",
19+
"schema" : {
20+
"type" : "integer",
21+
"minimum" : 1,
22+
"maximum" : 5,
23+
"example" : 2
24+
}
25+
} ],
26+
"responses" : {
27+
"200" : {
28+
"description" : "successully returned number of employees",
29+
"content" : {
30+
"application/json" : {
31+
"schema" : {
32+
"type" : "array",
33+
"items" : {
34+
"properties" : {
35+
"id" : {
36+
"type" : "integer",
37+
"example" : 4
38+
},
39+
"employee name" : {
40+
"type" : "string",
41+
"example" : "vijay"
42+
},
43+
"employee title" : {
44+
"type" : "string",
45+
"example" : "QA"
46+
}
47+
}
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
54+
}
55+
}
56+
},
357
"components" : {
458
"schemas" : {
559
"ReturnInformation": {
@@ -47,4 +101,4 @@
47101
}
48102
}
49103
}
50-
}
104+
}

0 commit comments

Comments
 (0)