You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/08/09 05:07:49 UTC

[GitHub] maheshrajus commented on a change in pull request #863: [SCB-736] generate default value to swagger for primitive type when there is no defaultValue annotation

maheshrajus commented on a change in pull request #863: [SCB-736] generate default value to swagger for primitive type when there is no defaultValue annotation
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/863#discussion_r208807437
 
 

 ##########
 File path: swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/OperationGenerator.java
 ##########
 @@ -315,8 +315,30 @@ protected void processByParameterAnnotation(Annotation[] paramAnnotations, int p
         }
       }
     }
-    if (parameter instanceof AbstractSerializableParameter && defaultValue != null) {
-      ((AbstractSerializableParameter<?>) parameter).setDefaultValue(defaultValue);
+    if (parameter instanceof AbstractSerializableParameter) {
+      if (defaultValue != null) {
+        ((AbstractSerializableParameter<?>) parameter).setDefaultValue(defaultValue);
+      } else if ((((AbstractSerializableParameter<?>) parameter).getDefaultValue() == null)
+          && (false == ((AbstractSerializableParameter<?>) parameter).getRequired())) { //if required false then only take java primitive values as defaults
 
 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:
users@infra.apache.org


With regards,
Apache Git Services