@@ -126,15 +126,16 @@ protected void calculatePath(OpenAPIBuilder openAPIBuilder, HandlerMethod handle
126
126
handlerMethod .getMethod (), io .swagger .v3 .oas .annotations .parameters .RequestBody .class );
127
127
128
128
// RequestBody in Operation
129
- requestBodyBuilder .buildRequestBodyFromDoc (requestBodyDoc , methodAttributes .getClassConsumes (),
130
- methodAttributes .getMethodConsumes (), components , null ).ifPresent (operation ::setRequestBody );
129
+ requestBodyBuilder
130
+ .buildRequestBodyFromDoc (requestBodyDoc , methodAttributes .getClassConsumes (),
131
+ methodAttributes .getMethodConsumes (), components , null )
132
+ .ifPresent (operation ::setRequestBody );
131
133
132
134
// requests
133
135
operation = requestBuilder .build (components , handlerMethod , requestMethod , operation , methodAttributes );
134
136
135
137
// responses
136
- ApiResponses apiResponses = responseBuilder .build (components , handlerMethod , operation ,
137
- methodAttributes );
138
+ ApiResponses apiResponses = responseBuilder .build (components , handlerMethod , operation , methodAttributes );
138
139
operation .setResponses (apiResponses );
139
140
140
141
List <io .swagger .v3 .oas .annotations .callbacks .Callback > apiCallbacks = ReflectionUtils
@@ -156,22 +157,31 @@ private Operation getExistingOperation(Map<HttpMethod, Operation> operationMap,
156
157
Operation existingOperation = null ;
157
158
if (!CollectionUtils .isEmpty (operationMap )) {
158
159
// Get existing operation definition
159
- if (RequestMethod .GET .equals (requestMethod )) {
160
+ switch (requestMethod ) {
161
+ case GET :
160
162
existingOperation = operationMap .get (HttpMethod .GET );
161
- } else if (RequestMethod .POST .equals (requestMethod )) {
163
+ break ;
164
+ case POST :
162
165
existingOperation = operationMap .get (HttpMethod .POST );
163
- } else if (RequestMethod .PUT .equals (requestMethod )) {
166
+ break ;
167
+ case PUT :
164
168
existingOperation = operationMap .get (HttpMethod .PUT );
165
- } else if (RequestMethod .DELETE .equals (requestMethod )) {
169
+ break ;
170
+ case DELETE :
166
171
existingOperation = operationMap .get (HttpMethod .DELETE );
167
- } else if (RequestMethod .PATCH .equals (requestMethod )) {
172
+ break ;
173
+ case PATCH :
168
174
existingOperation = operationMap .get (HttpMethod .PATCH );
169
- } else if (RequestMethod .TRACE .equals (requestMethod )) {
170
- existingOperation = operationMap .get (HttpMethod .TRACE );
171
- } else if (RequestMethod .HEAD .equals (requestMethod )) {
175
+ break ;
176
+ case HEAD :
172
177
existingOperation = operationMap .get (HttpMethod .HEAD );
173
- } else if (RequestMethod .OPTIONS .equals (requestMethod )) {
178
+ break ;
179
+ case OPTIONS :
174
180
existingOperation = operationMap .get (HttpMethod .OPTIONS );
181
+ break ;
182
+ default :
183
+ // Do nothing here
184
+ break ;
175
185
}
176
186
}
177
187
return existingOperation ;
0 commit comments