@@ -24,7 +24,7 @@ trait JaxrsApiReader extends ClassReader with ClassReaderUtils {
24
24
val GenericTypeMapper = " ([a-zA-Z\\ .]*)<([a-zA-Z0-9\\ .\\ ,\\ s]*)>" .r
25
25
26
26
// decorates a Parameter based on annotations, returns None if param should be ignored
27
- def processParamAnnotations (mutable : MutableParameter , paramAnnotations : Array [Annotation ]): Option [Parameter ]
27
+ def processParamAnnotations (mutable : MutableParameter , paramAnnotations : Array [Annotation ]): List [Parameter ]
28
28
29
29
// decorates an Operation
30
30
def processOperation (endpoint : String , operation : Operation , method : Method , apiOperation : ApiOperation ) : Operation = {
@@ -146,7 +146,7 @@ trait JaxrsApiReader extends ClassReader with ClassReaderUtils {
146
146
param.name = TYPE_BODY
147
147
param.paramType = TYPE_BODY
148
148
149
- Some (param.asParameter)
149
+ List (param.asParameter)
150
150
}
151
151
}).flatten.toList
152
152
@@ -260,24 +260,7 @@ trait JaxrsApiReader extends ClassReader with ClassReaderUtils {
260
260
case _ => None
261
261
}
262
262
// look for method-level annotated properties
263
- val parentParams : List [Parameter ] = (for (field <- getAllFields(cls))
264
- yield {
265
- // only process fields with @ApiParam, @QueryParam, @HeaderParam, @PathParam
266
- if (field.getAnnotation(classOf [QueryParam ]) != null || field.getAnnotation(classOf [HeaderParam ]) != null ||
267
- field.getAnnotation(classOf [HeaderParam ]) != null || field.getAnnotation(classOf [PathParam ]) != null ||
268
- field.getAnnotation(classOf [ApiParam ]) != null ) {
269
- val param = new MutableParameter
270
- param.dataType = field.getType.getName
271
- Option (field.getAnnotation(classOf [ApiParam ])) match {
272
- case Some (annotation) => toAllowableValues(annotation.allowableValues)
273
- case _ =>
274
- }
275
- val annotations = field.getAnnotations
276
- processParamAnnotations(param, annotations)
277
- }
278
- else None
279
- }
280
- ).flatten.toList
263
+ val parentParams : List [Parameter ] = getAllParamsFromFields(cls)
281
264
282
265
for (method <- cls.getMethods) {
283
266
val returnType = findSubresourceType(method)
@@ -345,6 +328,25 @@ trait JaxrsApiReader extends ClassReader with ClassReaderUtils {
345
328
}
346
329
return fields;
347
330
}
331
+
332
+ def getAllParamsFromFields (cls : Class [_]): List [Parameter ] = {
333
+ (for (field <- getAllFields(cls)) yield {
334
+ // only process fields with @ApiParam, @QueryParam, @HeaderParam, @PathParam
335
+ if (field.getAnnotation(classOf [QueryParam ]) != null || field.getAnnotation(classOf [HeaderParam ]) != null ||
336
+ field.getAnnotation(classOf [HeaderParam ]) != null || field.getAnnotation(classOf [PathParam ]) != null ||
337
+ field.getAnnotation(classOf [ApiParam ]) != null ) {
338
+ val param = new MutableParameter
339
+ param.dataType = field.getType.getName
340
+ Option (field.getAnnotation(classOf [ApiParam ])) match {
341
+ case Some (annotation) => toAllowableValues(annotation.allowableValues)
342
+ case _ =>
343
+ }
344
+ val annotations = field.getAnnotations
345
+ processParamAnnotations(param, annotations)
346
+ }
347
+ else List .empty
348
+ }).flatten.toList
349
+ }
348
350
349
351
def pathFromMethod (method : Method ): String = {
350
352
val path = method.getAnnotation(classOf [javax.ws.rs.Path ])
0 commit comments