Skip to content

Commit 4860056

Browse files
committed
added test for issue-12228
1 parent b358e64 commit 4860056

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

modules/swagger-parser-v2-converter/src/test/java/io/swagger/parser/test/V2ConverterTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ public class V2ConverterTest {
9494
private static final String ISSUE_1032_YAML = "issue-1032.yaml";
9595
private static final String ISSUE_1113_YAML = "issue-1113.yaml";
9696
private static final String ISSUE_1164_YAML = "issue-1164.yaml";
97+
private static final String ISSUE_1228_YAML = "issue-1228.json";
98+
9799

98100
private static final String API_BATCH_PATH = "/api/batch/";
99101
private static final String PETS_PATH = "/pets";
@@ -840,4 +842,13 @@ private OpenAPI getConvertedOpenAPIFromJsonFile(String file) throws IOException,
840842
assertNotNull(result);
841843
return result.getOpenAPI();
842844
}
845+
846+
@Test(description = "OpenAPI v2 converter - uses minimum and maximum fields")
847+
public void testissue1228() throws Exception {
848+
final OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_1228_YAML);
849+
assertNotNull(oas);
850+
assertNotNull(oas.getPaths().get("/foobar").getGet().getParameters().get(2).getSchema().getMinimum());
851+
assertNotNull(oas.getPaths().get("/foobar").getGet().getParameters().get(2).getSchema().getMaximum());
852+
853+
}
843854
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"swagger":"2.0",
3+
"info":{
4+
5+
},
6+
"host":"localhost:51552",
7+
"basePath":"/",
8+
"tags":[
9+
{
10+
"name":"foo-controller",
11+
"description":"Foo Controller"
12+
}
13+
],
14+
"paths":{
15+
"/foobar":{
16+
"get":{
17+
"tags":[
18+
"foo-controller"
19+
],
20+
"summary":"foo",
21+
"operationId":"fooUsingGET",
22+
"produces":[
23+
"*/*"
24+
],
25+
"parameters":[
26+
{
27+
"name":"bar",
28+
"in":"query",
29+
"required":false,
30+
"type":"integer",
31+
"maximum":4.0,
32+
"exclusiveMaximum":false,
33+
"minimum":3.0,
34+
"exclusiveMinimum":false,
35+
"format":"int32"
36+
},
37+
{
38+
"in":"body",
39+
"name":"bar",
40+
"description":"bar",
41+
"required":false,
42+
"schema":{
43+
"type":"integer",
44+
"format":"int32"
45+
}
46+
},
47+
{
48+
"name":"bars",
49+
"in":"query",
50+
"required":true,
51+
"type":"array",
52+
"items":{
53+
"type":"integer",
54+
"format":"int32"
55+
},
56+
"collectionFormat":"multi",
57+
"maximum":2,
58+
"minimum":1
59+
},
60+
{
61+
"in":"body",
62+
"name":"bars",
63+
"description":"bars",
64+
"required":true,
65+
"schema":{
66+
"type":"array",
67+
"items":{
68+
"type":"integer",
69+
"format":"int32"
70+
}
71+
}
72+
},
73+
{
74+
"name":"foo",
75+
"in":"query",
76+
"required":false,
77+
"type":"string",
78+
"pattern":"foo"
79+
},
80+
{
81+
"in":"body",
82+
"name":"foo",
83+
"description":"foo",
84+
"required":false,
85+
"pattern":"foo",
86+
"schema":{
87+
"type":"string"
88+
}
89+
}
90+
],
91+
"responses":{
92+
"200":{
93+
"description":"OK"
94+
},
95+
"401":{
96+
"description":"Unauthorized"
97+
},
98+
"403":{
99+
"description":"Forbidden"
100+
},
101+
"404":{
102+
"description":"Not Found"
103+
}
104+
},
105+
"deprecated":false
106+
}
107+
}
108+
}
109+
}

0 commit comments

Comments
 (0)