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/08/31 01:36:12 UTC

[GitHub] [servicecomb-java-chassis] neville-nie opened a new issue #1934: 使用swagger-invocation-validator做参数校验时,spring的@RequestParam设置的defaultValue在传入空值时好像没有生效

neville-nie opened a new issue #1934:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1934


   eg:参数marker设置了
   @Valid 
   @Pattern(regexp = "^[a-fA-F0-9]{24}$") @RequestParam(value = "marker", defaultValue = "ffffffffffffffffffffffff", required = false)String marker
   但是在传入参数 urlXXX?marker=& 形式的空值时,校验正则会不通过。
   
   
   org.apache.servicecomb.swagger.engine.SwaggerProducerOperation.doInvoke(SwaggerProducerOperation.java:203)|unexpected error PRODUCER rest IoDeviceMgr.com.huawei.m2m.rest.api.iodevicemgr.service.CertificateManagementController.listCertificates,
   javax.validation.ConstraintViolationException: listCertificates.marker: must match "^[a-fA-F0-9]{24}$"
           at org.apache.servicecomb.swagger.invocation.validator.ParameterValidator.beforeMethodInvoke(ParameterValidator.java:60) ~[swagger-invocation-validator-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.swagger.engine.SwaggerProducerOperation.doInvoke(SwaggerProducerOperation.java:185) ~[swagger-invocation-core-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.swagger.engine.SwaggerProducerOperation.syncInvoke(SwaggerProducerOperation.java:173) ~[swagger-invocation-core-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.swagger.engine.SwaggerProducerOperation.invoke(SwaggerProducerOperation.java:123) ~[swagger-invocation-core-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.core.handler.impl.ProducerOperationHandler.handle(ProducerOperationHandler.java:40) ~[java-chassis-core-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.core.Invocation.next(Invocation.java:204) ~[java-chassis-core-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.qps.ProviderQpsFlowControlHandler.handle(ProviderQpsFlowControlHandler.java:38) ~[handler-flowcontrol-qps-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.core.Invocation.next(Invocation.java:204) ~[java-chassis-core-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.common.rest.AbstractRestInvocation.doInvoke(AbstractRestInvocation.java:243) ~[common-rest-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.common.rest.AbstractRestInvocation.invoke(AbstractRestInvocation.java:217) ~[common-rest-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.common.rest.AbstractRestInvocation.runOnExecutor(AbstractRestInvocation.java:201) ~[common-rest-1.3.0.jar:1.3.0]
           at org.apache.servicecomb.common.rest.AbstractRestInvocation.lambda$scheduleInvocation$0(AbstractRestInvocation.java:160) ~[common-rest-1.3.0.jar:1.3.0]
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_242]
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_242]
           at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]


----------------------------------------------------------------
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 #1934: 使用swagger-invocation-validator做参数校验时,spring的@RequestParam设置的defaultValue在传入空值时好像没有生效。 ServiceComb 1.3.0版本

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


   java-chassis默认使用的是 hibernate validation , 不是 spring validation。 spring validation 在 java validation API 基础上做了一些自己的扩展, 无法在 java-chassis 使用。 spring validation 和 spring MVC 存在很大程度的耦合, 不容易集成到 java-chassis. 


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