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/12/17 02:52:07 UTC

[GitHub] [servicecomb-java-chassis] HoyerIsAlexander commented on issue #2081: servicecomb升级至2.1.2版本后,接口List对象请求参数设置值方式修改

HoyerIsAlexander commented on issue #2081:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2081#issuecomment-747170110


   CSE版本:3.1.5 ServiceComb版本:2.1.2 Jackson版本:2.11.0
   
   业务代码:
   
   `
   API接口
   
   public interface ApiInterface {
    QueryRsp query(@Valid QueryParam queryParam);
   }
   
   API实现类
   
   @RestSchema(schemaId = "apiImpl")
   @Path("")
   @Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
   @Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"})
   public class ApiImpl {
       @GET
       @Path("/query")
       @Override
       QueryRsp query(@BeanParam QueryParam queryParam) {
       //TODO
       }
   }
   
   QueryParam 
   
   @Data
   public class IncidentLogQueryParam{
       @QueryParam("params")
       private List<@NotNull Integer> params;
   }
   `
   
   浏览器请求:
   
   `http://localhost:8080/query?params=`
   
   结果:
   
   "params:[null]"
   
   
   另外新增Post接口
   
   业务代码:
   `Param  private List<String> params`
   
   请求参数:
   `{
   params: ''
    }`
   
   结果:
   
   "params:[""]"
   
   


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