You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by GitBox <gi...@apache.org> on 2019/04/08 04:46:49 UTC

[GitHub] [geronimo-openapi] rmannibucau commented on a change in pull request #14: The AnnotationProcessor should be able to deduct the parameter name from JAX-RS annotations

rmannibucau commented on a change in pull request #14: The AnnotationProcessor should be able to deduct the parameter name from JAX-RS annotations
URL: https://github.com/apache/geronimo-openapi/pull/14#discussion_r272884393
 
 

 ##########
 File path: geronimo-openapi-impl/src/main/java/org/apache/geronimo/microprofile/openapi/impl/processor/AnnotationProcessor.java
 ##########
 @@ -881,18 +882,32 @@ private Encoding mapEncoding(final Supplier<org.eclipse.microprofile.openapi.mod
         }
         if (annotatedElement != null) {
             if (annotatedElement.isAnnotationPresent(HeaderParam.class)) {
+                final HeaderParam annotation = annotatedElement.getAnnotation(HeaderParam.class);
                 impl.in(org.eclipse.microprofile.openapi.models.parameters.Parameter.In.HEADER);
+                mapParameterName(impl, annotation.value());
             } else if (annotatedElement.isAnnotationPresent(CookieParam.class)) {
+                final CookieParam annotation = annotatedElement.getAnnotation(CookieParam.class);
                 impl.in(org.eclipse.microprofile.openapi.models.parameters.Parameter.In.COOKIE);
+                mapParameterName(impl, annotation.value());
             } else if (annotatedElement.isAnnotationPresent(PathParam.class)) {
+                final PathParam annotation = annotatedElement.getAnnotation(PathParam.class);
                 impl.in(org.eclipse.microprofile.openapi.models.parameters.Parameter.In.PATH);
+                mapParameterName(impl, annotation.value());
             } else if (annotatedElement.isAnnotationPresent(QueryParam.class)) {
+                final QueryParam annotation = annotatedElement.getAnnotation(QueryParam.class);
                 impl.in(org.eclipse.microprofile.openapi.models.parameters.Parameter.In.QUERY);
+                mapParameterName(impl, annotation.value());
             }
         }
         return impl;
     }
 
+    private void mapParameterName(final ParameterImpl impl, final String name) {
+        if (StringUtils.isEmpty(impl.getName()) && !StringUtils.isEmpty(name)) {
 
 Review comment:
   Can name be empty? Dont think so and zvzn if so it would be the same so second test is useless right?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services