Skip to content

Commit 676fe7a

Browse files
Merge pull request microprofile#420 from phillip-kruger/master
Default in Vert.x when no path is specified ALL
2 parents ec22101 + f7e6015 commit 676fe7a

File tree

2 files changed

+309
-11
lines changed

2 files changed

+309
-11
lines changed

extension-vertx/src/main/java/io/smallrye/openapi/vertx/VertxAnnotationScanner.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,12 @@ public boolean isAsyncResponse(final MethodInfo method) {
5858

5959
@Override
6060
public boolean isPostMethod(final MethodInfo method) {
61-
if (hasRouteMethod(method, HttpMethod.POST)) {
62-
return true;
63-
}
64-
return false;
61+
return hasRouteMethod(method, HttpMethod.POST);
6562
}
6663

6764
@Override
6865
public boolean isDeleteMethod(final MethodInfo method) {
69-
if (hasRouteMethod(method, HttpMethod.DELETE)) {
70-
return true;
71-
}
72-
return false;
66+
return hasRouteMethod(method, HttpMethod.DELETE);
7367
}
7468

7569
@Override
@@ -225,9 +219,12 @@ private void processRouteMethods(final AnnotationScannerContext context,
225219
}
226220
}
227221
} else {
228-
// Default to GET
229-
processRouteMethod(context, resourceClass, methodInfo, PathItem.HttpMethod.GET, openApi, tagRefs,
230-
locatorPathParameters);
222+
// Default to ALL
223+
PathItem.HttpMethod[] all = PathItem.HttpMethod.values();
224+
for (PathItem.HttpMethod httpMethod : all) {
225+
processRouteMethod(context, resourceClass, methodInfo, httpMethod, openApi, tagRefs,
226+
locatorPathParameters);
227+
}
231228
}
232229
} else {
233230
// TODO: Default ? Look at RouteBase

extension-vertx/src/test/resources/io/smallrye/openapi/runtime/scanner/resource.testBasicRouteGetDefinitionScanning.json

+301
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,160 @@
2323
}
2424
}
2525
}
26+
},
27+
"put" : {
28+
"parameters" : [ {
29+
"name" : "name",
30+
"in" : "path",
31+
"required" : true,
32+
"schema" : {
33+
"type" : "string"
34+
}
35+
} ],
36+
"responses" : {
37+
"200" : {
38+
"description" : "OK",
39+
"content" : {
40+
"application/json" : {
41+
"schema" : {
42+
"$ref" : "#/components/schemas/Greeting"
43+
}
44+
}
45+
}
46+
}
47+
}
48+
},
49+
"post" : {
50+
"parameters" : [ {
51+
"name" : "name",
52+
"in" : "path",
53+
"required" : true,
54+
"schema" : {
55+
"type" : "string"
56+
}
57+
} ],
58+
"responses" : {
59+
"200" : {
60+
"description" : "OK",
61+
"content" : {
62+
"application/json" : {
63+
"schema" : {
64+
"$ref" : "#/components/schemas/Greeting"
65+
}
66+
}
67+
}
68+
}
69+
}
70+
},
71+
"delete" : {
72+
"parameters" : [ {
73+
"name" : "name",
74+
"in" : "path",
75+
"required" : true,
76+
"schema" : {
77+
"type" : "string"
78+
}
79+
} ],
80+
"responses" : {
81+
"200" : {
82+
"description" : "OK",
83+
"content" : {
84+
"application/json" : {
85+
"schema" : {
86+
"$ref" : "#/components/schemas/Greeting"
87+
}
88+
}
89+
}
90+
}
91+
}
92+
},
93+
"options" : {
94+
"parameters" : [ {
95+
"name" : "name",
96+
"in" : "path",
97+
"required" : true,
98+
"schema" : {
99+
"type" : "string"
100+
}
101+
} ],
102+
"responses" : {
103+
"200" : {
104+
"description" : "OK",
105+
"content" : {
106+
"application/json" : {
107+
"schema" : {
108+
"$ref" : "#/components/schemas/Greeting"
109+
}
110+
}
111+
}
112+
}
113+
}
114+
},
115+
"head" : {
116+
"parameters" : [ {
117+
"name" : "name",
118+
"in" : "path",
119+
"required" : true,
120+
"schema" : {
121+
"type" : "string"
122+
}
123+
} ],
124+
"responses" : {
125+
"200" : {
126+
"description" : "OK",
127+
"content" : {
128+
"application/json" : {
129+
"schema" : {
130+
"$ref" : "#/components/schemas/Greeting"
131+
}
132+
}
133+
}
134+
}
135+
}
136+
},
137+
"patch" : {
138+
"parameters" : [ {
139+
"name" : "name",
140+
"in" : "path",
141+
"required" : true,
142+
"schema" : {
143+
"type" : "string"
144+
}
145+
} ],
146+
"responses" : {
147+
"200" : {
148+
"description" : "OK",
149+
"content" : {
150+
"application/json" : {
151+
"schema" : {
152+
"$ref" : "#/components/schemas/Greeting"
153+
}
154+
}
155+
}
156+
}
157+
}
158+
},
159+
"trace" : {
160+
"parameters" : [ {
161+
"name" : "name",
162+
"in" : "path",
163+
"required" : true,
164+
"schema" : {
165+
"type" : "string"
166+
}
167+
} ],
168+
"responses" : {
169+
"200" : {
170+
"description" : "OK",
171+
"content" : {
172+
"application/json" : {
173+
"schema" : {
174+
"$ref" : "#/components/schemas/Greeting"
175+
}
176+
}
177+
}
178+
}
179+
}
26180
}
27181
},
28182
"/greeting/helloOptional/{name}" : {
@@ -70,6 +224,153 @@
70224
}
71225
}
72226
}
227+
},
228+
"put" : {
229+
"parameters" : [ {
230+
"name" : "name",
231+
"in" : "query",
232+
"schema" : {
233+
"type" : "string"
234+
}
235+
} ],
236+
"responses" : {
237+
"200" : {
238+
"description" : "OK",
239+
"content" : {
240+
"application/json" : {
241+
"schema" : {
242+
"$ref" : "#/components/schemas/Greeting"
243+
}
244+
}
245+
}
246+
}
247+
}
248+
},
249+
"post" : {
250+
"parameters" : [ {
251+
"name" : "name",
252+
"in" : "query",
253+
"schema" : {
254+
"type" : "string"
255+
}
256+
} ],
257+
"responses" : {
258+
"200" : {
259+
"description" : "OK",
260+
"content" : {
261+
"application/json" : {
262+
"schema" : {
263+
"$ref" : "#/components/schemas/Greeting"
264+
}
265+
}
266+
}
267+
}
268+
}
269+
},
270+
"delete" : {
271+
"parameters" : [ {
272+
"name" : "name",
273+
"in" : "query",
274+
"schema" : {
275+
"type" : "string"
276+
}
277+
} ],
278+
"responses" : {
279+
"200" : {
280+
"description" : "OK",
281+
"content" : {
282+
"application/json" : {
283+
"schema" : {
284+
"$ref" : "#/components/schemas/Greeting"
285+
}
286+
}
287+
}
288+
}
289+
}
290+
},
291+
"options" : {
292+
"parameters" : [ {
293+
"name" : "name",
294+
"in" : "query",
295+
"schema" : {
296+
"type" : "string"
297+
}
298+
} ],
299+
"responses" : {
300+
"200" : {
301+
"description" : "OK",
302+
"content" : {
303+
"application/json" : {
304+
"schema" : {
305+
"$ref" : "#/components/schemas/Greeting"
306+
}
307+
}
308+
}
309+
}
310+
}
311+
},
312+
"head" : {
313+
"parameters" : [ {
314+
"name" : "name",
315+
"in" : "query",
316+
"schema" : {
317+
"type" : "string"
318+
}
319+
} ],
320+
"responses" : {
321+
"200" : {
322+
"description" : "OK",
323+
"content" : {
324+
"application/json" : {
325+
"schema" : {
326+
"$ref" : "#/components/schemas/Greeting"
327+
}
328+
}
329+
}
330+
}
331+
}
332+
},
333+
"patch" : {
334+
"parameters" : [ {
335+
"name" : "name",
336+
"in" : "query",
337+
"schema" : {
338+
"type" : "string"
339+
}
340+
} ],
341+
"responses" : {
342+
"200" : {
343+
"description" : "OK",
344+
"content" : {
345+
"application/json" : {
346+
"schema" : {
347+
"$ref" : "#/components/schemas/Greeting"
348+
}
349+
}
350+
}
351+
}
352+
}
353+
},
354+
"trace" : {
355+
"parameters" : [ {
356+
"name" : "name",
357+
"in" : "query",
358+
"schema" : {
359+
"type" : "string"
360+
}
361+
} ],
362+
"responses" : {
363+
"200" : {
364+
"description" : "OK",
365+
"content" : {
366+
"application/json" : {
367+
"schema" : {
368+
"$ref" : "#/components/schemas/Greeting"
369+
}
370+
}
371+
}
372+
}
373+
}
73374
}
74375
},
75376
"/greeting/helloPathVariable/{name}" : {

0 commit comments

Comments
 (0)