Skip to content

Commit 0b12da5

Browse files
committed
added review comment changes
1 parent c2f024f commit 0b12da5

File tree

4 files changed

+237
-4
lines changed

4 files changed

+237
-4
lines changed

modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,9 +1385,7 @@ public Map<String, Parameter> getParameters(ObjectNode obj, String location, Par
13851385
}
13861386
}
13871387
}
1388-
if(!filter.add(parameter.getName()+"#"+parameter.getIn())) {
1389-
result.warning(location,"There are duplicate parameter values");
1390-
}
1388+
13911389
}
13921390
return parameters;
13931391
}

modules/swagger-parser/src/test/java/io/swagger/parser/OpenAPIParserTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ public void testIssue879() {
466466
public void testIssue959() {
467467
OpenAPIParser openAPIParser = new OpenAPIParser();
468468
SwaggerParseResult result = openAPIParser.readLocation("issue959.json",null,null);
469-
assertEquals(result.getMessages().size(),2);
469+
assertEquals(result.getMessages().get(0),"attribute paths.'/pets/{petId}'(get).parameters.There are duplicate parameter values");
470+
471+
result = openAPIParser.readLocation("issue959PathLevelDuplication.json",null,null);
472+
assertEquals(result.getMessages().get(0),"attribute paths.'/pets'.There are duplicate parameter values");
473+
470474
}
475+
471476
}
477+

modules/swagger-parser/src/test/resources/issue959.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
],
2020
"paths": {
2121
"/pets": {
22+
"parameters": [
23+
{
24+
"name": "limit",
25+
"in": "query",
26+
"description": "How many items to return at one time (max 100)",
27+
"required": false,
28+
"schema": {
29+
"type": "integer",
30+
"format": "int32"
31+
}
32+
}
33+
],
2234
"get": {
2335
"summary": "List all pets",
2436
"operationId": "listPets",
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
{
2+
"openapi": "3.0.1",
3+
"info": {
4+
"version": "1.0.0",
5+
"title": "Swagger Petstore",
6+
"license": {
7+
"name": "MIT"
8+
}
9+
},
10+
"servers": [
11+
{
12+
"url": "http://petstore.swagger.io/v1"
13+
}
14+
],
15+
"tags" : [
16+
{"name":"pet" ,
17+
"description":"+ data"
18+
}
19+
],
20+
"paths": {
21+
"/pets": {
22+
"parameters": [
23+
{
24+
"name": "limit",
25+
"in": "query",
26+
"description": "How many items to return at one time (max 100)",
27+
"required": false,
28+
"schema": {
29+
"type": "integer",
30+
"format": "int32"
31+
}
32+
},
33+
{
34+
"name": "limit",
35+
"in": "query",
36+
"description": "How many items to return at one time (max 100)",
37+
"required": false,
38+
"schema": {
39+
"type": "integer",
40+
"format": "int32"
41+
}
42+
}
43+
],
44+
"get": {
45+
"summary": "List all pets",
46+
"operationId": "listPets",
47+
"tags": [
48+
"pets"
49+
],
50+
"responses": {
51+
"200": {
52+
"description": "A paged array of pets",
53+
"headers": {
54+
"x-next": {
55+
"description": "A link to the next page of responses",
56+
"schema": {
57+
"type": "string"
58+
}
59+
}
60+
},
61+
"content": {
62+
"application/json": {
63+
"schema": {
64+
"$ref": "#/components/schemas/Pets"
65+
}
66+
}
67+
}
68+
},
69+
"default": {
70+
"description": "unexpected error",
71+
"content": {
72+
"application/json": {
73+
"schema": {
74+
"$ref": "#/components/schemas/Error"
75+
}
76+
}
77+
}
78+
}
79+
}
80+
},
81+
"post": {
82+
"summary": "Create a pet",
83+
"operationId": "createPets",
84+
"tags": [
85+
"pets"
86+
],
87+
"responses": {
88+
"201": {
89+
"description": "Null response"
90+
},
91+
"default": {
92+
"description": "unexpected error",
93+
"content": {
94+
"application/json": {
95+
"schema": {
96+
"$ref": "#/components/schemas/Error"
97+
}
98+
}
99+
}
100+
}
101+
}
102+
}
103+
},
104+
"/pets/{petId}": {
105+
"get": {
106+
"summary": "Info for a specific pet",
107+
"operationId": "showPetById",
108+
"tags": [
109+
"pets"
110+
],
111+
"parameters": [
112+
{
113+
"name": "petId",
114+
"in": "path",
115+
"required": true,
116+
"description": "The id of the pet to retrieve",
117+
"schema": {
118+
"type": "string"
119+
}
120+
}
121+
],
122+
"responses": {
123+
"200": {
124+
"description": "Expected response to a valid request",
125+
"content": {
126+
"application/json": {
127+
"schema": {
128+
"$ref": "#/components/schemas/Pets"
129+
}
130+
}
131+
}
132+
},
133+
"default": {
134+
"description": "unexpected error",
135+
"content": {
136+
"application/json": {
137+
"schema": {
138+
"$ref": "#/components/schemas/Error"
139+
}
140+
}
141+
}
142+
}
143+
}
144+
}
145+
}
146+
},
147+
"components": {
148+
"schemas": {
149+
"Pet": {
150+
"required": [
151+
"id",
152+
"name"
153+
],
154+
"properties": {
155+
"id": {
156+
"type": "integer",
157+
"format": "int64"
158+
},
159+
"name": {
160+
"type": "string"
161+
},
162+
"tag": {
163+
"type": "string"
164+
}
165+
}
166+
},
167+
"Pets": {
168+
"type": "array",
169+
"items": {
170+
"$ref": "#/components/schemas/Pet"
171+
}
172+
},
173+
"Error": {
174+
"required": [
175+
"code",
176+
"message"
177+
],
178+
"properties": {
179+
"code": {
180+
"type": "integer",
181+
"format": "int32"
182+
},
183+
"message": {
184+
"type": "string"
185+
}
186+
}
187+
}
188+
},
189+
"parameters": {
190+
"offsetParam": {
191+
"name": "offset",
192+
"in": "query",
193+
"description": "Number of items to skip before returning the results.",
194+
"required": false,
195+
"schema": {
196+
"type": "integer",
197+
"format": "int32",
198+
"minimum": 0,
199+
"default": 0
200+
}
201+
},
202+
"limitParam": {
203+
"name": "offset",
204+
"in": "query",
205+
"description": "Maximum number of items to return.",
206+
"required": false,
207+
"schema": {
208+
"type": "integer",
209+
"format": "int32",
210+
"minimum": 1,
211+
"maximum": 100,
212+
"default": 20
213+
}
214+
}
215+
}
216+
}
217+
}

0 commit comments

Comments
 (0)