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 2020/07/30 12:41:30 UTC

[GitHub] [servicecomb-java-chassis] yhs0092 opened a new issue #1902: SpringMVC开发风格下,2.x版本的Java-Chassis不再支持传输非文件类型的form参数了

yhs0092 opened a new issue #1902:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1902


   ```java
     @PostMapping(path = "/hello/form", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     public String form(@RequestPart(name = "file", required = false) MultipartFile file,
         @RequestPart(value = "val") String val) throws IOException {
       LOGGER.info("file content = {}, val = {}",
           Objects.isNull(file) ? file : new String(file.getBytes()),
           val);
       return val;
     }
   ```
   假设定义如上REST接口,1.x版本的 Java-Chassis 生成的契约中会标识 file 参数的类型是 `file` ,而 val 参数的类型是 `string` 。而使用2.x版本的 Java-Chassis 框架, file 参数和 val 参数在契约中的类型都是 `file` 。这导致 val 参数无法获取到值,传入业务代码的一直都是 `null` 。
   
   问题的根因在 `org.apache.servicecomb.swagger.generator.springmvc.processor.annotation.RequestPartAnnotationProcessor#fillParameter` 方法中, 2.x版本的 Java-Chassis 在这里没有对REST接口类方法参数的类型进行判断,直接将 formParameter 的 property 设置为 FileProperty 类型了,导致生成的契约中 form 参数的类型一直是 `file` 。


----------------------------------------------------------------
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



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1902: SpringMVC开发风格下,2.x版本的Java-Chassis不再支持传输非文件类型的form参数了

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1902:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1902#issuecomment-672546199


   fixed in 2.1.1


----------------------------------------------------------------
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



[GitHub] [servicecomb-java-chassis] yhs0092 commented on issue #1902: SpringMVC开发风格下,2.x版本的Java-Chassis不再支持传输非文件类型的form参数了

Posted by GitBox <gi...@apache.org>.
yhs0092 commented on issue #1902:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1902#issuecomment-667970476


   This problem is tracked by https://issues.apache.org/jira/browse/SCB-2058


----------------------------------------------------------------
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



[GitHub] [servicecomb-java-chassis] liubao68 closed issue #1902: SpringMVC开发风格下,2.x版本的Java-Chassis不再支持传输非文件类型的form参数了

Posted by GitBox <gi...@apache.org>.
liubao68 closed issue #1902:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1902


   


----------------------------------------------------------------
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