@@ -172,22 +172,22 @@ public Operation build(HandlerMethod handlerMethod, RequestMethod requestMethod,
172
172
for (MethodParameter methodParameter : parameters ) {
173
173
// check if query param
174
174
Parameter parameter = null ;
175
- final String pName = methodParameter .getParameterName ();
176
175
io .swagger .v3 .oas .annotations .Parameter parameterDoc = methodParameter .getParameterAnnotation (io .swagger .v3 .oas .annotations .Parameter .class );
176
+ final String pName = methodParameter .getParameterName ();
177
+ ParameterInfo parameterInfo = new ParameterInfo (pName , methodParameter );
178
+
177
179
if (parameterDoc == null )
178
- parameterDoc = parametersDocMap .get (pName );
180
+ parameterDoc = parametersDocMap .get (parameterInfo . getpName () );
179
181
// use documentation as reference
180
182
if (parameterDoc != null ) {
181
183
if (parameterDoc .hidden ())
182
184
continue ;
183
- parameter = parameterBuilder .buildParameterFromDoc (parameterDoc , null ,
184
- methodAttributes . getJsonViewAnnotation () );
185
+ parameter = parameterBuilder .buildParameterFromDoc (parameterDoc , null , methodAttributes . getJsonViewAnnotation ());
186
+ parameterInfo . setParameterModel ( parameter );
185
187
}
186
188
187
189
if (!isParamToIgnore (methodParameter )) {
188
- ParameterInfo parameterInfo = new ParameterInfo (pName , methodParameter , parameter );
189
- parameter = buildParams (parameterInfo , components , requestMethod ,
190
- methodAttributes .getJsonViewAnnotation ());
190
+ parameter = buildParams (parameterInfo , components , requestMethod , methodAttributes .getJsonViewAnnotation ());
191
191
// Merge with the operation parameters
192
192
parameter = parameterBuilder .mergeParameter (operationParameters , parameter );
193
193
List <Annotation > parameterAnnotations = Arrays .asList (methodParameter .getParameterAnnotations ());
@@ -279,34 +279,31 @@ private boolean isValidParameter(Parameter parameter) {
279
279
private Parameter buildParams (ParameterInfo parameterInfo , Components components ,
280
280
RequestMethod requestMethod , JsonView jsonView ) {
281
281
MethodParameter methodParameter = parameterInfo .getMethodParameter ();
282
- RequestHeader requestHeader = methodParameter .getParameterAnnotation (RequestHeader .class );
283
- RequestParam requestParam = methodParameter .getParameterAnnotation (RequestParam .class );
284
- PathVariable pathVar = methodParameter .getParameterAnnotation (PathVariable .class );
285
- CookieValue cookieValue = methodParameter .getParameterAnnotation (CookieValue .class );
282
+ RequestHeader requestHeader = parameterInfo .getRequestHeader ();
283
+ RequestParam requestParam = parameterInfo .getRequestParam ();
284
+ PathVariable pathVar = parameterInfo .getPathVar ();
285
+ CookieValue cookieValue = parameterInfo .getCookieValue ();
286
+
286
287
Parameter parameter = null ;
287
288
RequestInfo requestInfo ;
288
289
289
290
if (requestHeader != null ) {
290
- requestInfo = new RequestInfo (ParameterIn .HEADER .toString (), requestHeader . value (), requestHeader .required (),
291
+ requestInfo = new RequestInfo (ParameterIn .HEADER .toString (), parameterInfo . getpName (), requestHeader .required (),
291
292
requestHeader .defaultValue ());
292
293
parameter = buildParam (parameterInfo , components , requestInfo , jsonView );
293
294
294
295
}
295
296
else if (requestParam != null && !parameterBuilder .isFile (parameterInfo .getMethodParameter ())) {
296
- requestInfo = new RequestInfo (ParameterIn .QUERY .toString (), requestParam . value (), requestParam .required () && !methodParameter .isOptional (),
297
+ requestInfo = new RequestInfo (ParameterIn .QUERY .toString (), parameterInfo . getpName (), requestParam .required () && !methodParameter .isOptional (),
297
298
requestParam .defaultValue ());
298
299
parameter = buildParam (parameterInfo , components , requestInfo , jsonView );
299
300
}
300
301
else if (pathVar != null ) {
301
- String pName = parameterInfo .getpName ();
302
- String name = StringUtils .isBlank (pathVar .value ()) ? pName : pathVar .value ();
303
- parameterInfo .setpName (name );
304
- // check if PATH PARAM
305
- requestInfo = new RequestInfo (ParameterIn .PATH .toString (), pathVar .value (), !methodParameter .isOptional (), null );
302
+ requestInfo = new RequestInfo (ParameterIn .PATH .toString (), parameterInfo .getpName (), !methodParameter .isOptional (), null );
306
303
parameter = buildParam (parameterInfo , components , requestInfo , jsonView );
307
304
}
308
305
else if (cookieValue != null ) {
309
- requestInfo = new RequestInfo (ParameterIn .COOKIE .toString (), cookieValue . value (), cookieValue .required (),
306
+ requestInfo = new RequestInfo (ParameterIn .COOKIE .toString (), parameterInfo . getpName (), cookieValue .required (),
310
307
cookieValue .defaultValue ());
311
308
parameter = buildParam (parameterInfo , components , requestInfo , jsonView );
312
309
}
0 commit comments