[GitHub] wujimin commented on a change in pull request #882: [SCB-206] Support setting produces and consumes by @Api

2018-08-23 Thread GitBox
wujimin commented on a change in pull request #882: [SCB-206] Support setting 
produces and consumes by @Api
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/882#discussion_r212331169
 
 

 ##
 File path: 
swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/processor/annotation/ApiProcessor.java
 ##
 @@ -17,18 +17,69 @@
 
 package org.apache.servicecomb.swagger.generator.core.processor.annotation;
 
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import org.apache.servicecomb.swagger.generator.core.ClassAnnotationProcessor;
 import org.apache.servicecomb.swagger.generator.core.SwaggerGenerator;
 import org.springframework.util.StringUtils;
 
 import io.swagger.annotations.Api;
+import io.swagger.models.Swagger;
 
 public class ApiProcessor implements ClassAnnotationProcessor {
   @Override
   public void process(Object annotation, SwaggerGenerator swaggerGenerator) {
 Api api = (Api) annotation;
 
 setTags(api, swaggerGenerator);
+// except for @Api, @RequestMapping can also set consumes and produces
+// @RequestMapping takes HIGHER priority than @Api for legacy reason
+processConsumes(api, swaggerGenerator.getSwagger());
 
 Review comment:
   ok


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


With regards,
Apache Git Services


[GitHub] wujimin commented on a change in pull request #882: [SCB-206] Support setting produces and consumes by @Api

2018-08-22 Thread GitBox
wujimin commented on a change in pull request #882: [SCB-206] Support setting 
produces and consumes by @Api
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/882#discussion_r211966301
 
 

 ##
 File path: 
swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/processor/annotation/ApiProcessor.java
 ##
 @@ -17,18 +17,69 @@
 
 package org.apache.servicecomb.swagger.generator.core.processor.annotation;
 
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import org.apache.servicecomb.swagger.generator.core.ClassAnnotationProcessor;
 import org.apache.servicecomb.swagger.generator.core.SwaggerGenerator;
 import org.springframework.util.StringUtils;
 
 import io.swagger.annotations.Api;
+import io.swagger.models.Swagger;
 
 public class ApiProcessor implements ClassAnnotationProcessor {
   @Override
   public void process(Object annotation, SwaggerGenerator swaggerGenerator) {
 Api api = (Api) annotation;
 
 setTags(api, swaggerGenerator);
+// except for @Api, @RequestMapping can also set consumes and produces
+// @RequestMapping takes HIGHER priority than @Api for legacy reason
+processConsumes(api, swaggerGenerator.getSwagger());
 
 Review comment:
   i can not find the priority control


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


With regards,
Apache Git Services