[ 
https://issues.apache.org/jira/browse/SCB-925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16701554#comment-16701554
 ] 

ASF GitHub Bot commented on SCB-925:
------------------------------------

weichao666 edited a comment on issue #1004: [SCB-925] Springmvc, when have 
defaultValue, required should be false, when param not exist, should check 
isRequired
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1004#issuecomment-441191265
 
 
   swagger annotation: ApiImplicitParam
   因为swagger的读取逻辑并没有在required、defaultValue之间产生干扰关系
   所以,使用下面规则处理:
   
   - 生成契约
     swagger annotation,用户写什么,就生成什么
     jaxrs,用户写什么,就生成什么
     springmvc,按springmvc标准
         如果没写defaultValue,required写什么,就生成什么
         如果写了defaultValue,则无论用户是怎么写的,required在契约中都是false
   
   - 运行时
   
     当相应的param未传输时,如果required为true,则报错
     当相应的param未传输时,如果required为false,则按defaultValue处理
   本次改动涉及变更:
   修改前效果:
   
   - 生成契约:
   
       对于springmvc开发方式,不管写没写defaultValue,required在契约中都是true,除非手动设为false
   
   - 运行时:
   
       当相应的param未传输时,按照defaultValue处理
   修改后效果对比:
   
   - 生成契约:
   
       对于springmvc开发方式,
           1. 如果没写defaultValue,required写什么,就生成什么
           2. 如果写了defaultValue,则无论用户是怎么写的,required在契约中都是false
   
   - 运行时
   
       1. 当相应的param未传输时,如果required为true,则报错
       2. 当相应的param未传输时,如果required为false,则按defaultValue处理
       
   
   Generating schema:
     Springmvc,
       if do not write defaultValue, required's value is what user write
       if have written defaultValue,No matter how the user writes,required is 
false
   
   running:
     When param is not transmitted,if required is true, report error
     When param is not transmitted , if required is false, handle it with 
defaultValue

----------------------------------------------------------------
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:
[email protected]


> Springmvc, when have defaultValue, required should be false
> -----------------------------------------------------------
>
>                 Key: SCB-925
>                 URL: https://issues.apache.org/jira/browse/SCB-925
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Java-Chassis
>            Reporter: WeiChao
>            Assignee: WeiChao
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to