COLA框架支持javax.validation注解校验返回Response么?
- Dominant language
- Java
- Stars
- 13k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
2022-08-21 23:24:14.261 WARN 4508 --- [nio-8888-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.bind.MethodArgumentNotValidException: Validation failed for argument [0] in public com.alibaba.cola.dto.Response tech.huning.cola.demo.web.web.CustomerController.addCustomer(tech.huning.cola.demo.web.dto.CustomerAddCmd): [Field error in object 'customerAddCmd' on field 'customerDTO.source': rejected value []; codes [NotEmpty.customerAddCmd.customerDTO.source,NotEmpty.customerDTO.source,NotEmpty.source,NotEmpty.java.lang.String,NotEmpty]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [customerAddCmd.customerDTO.source,customerDTO.source]; arguments []; default message [customerDTO.source]]; default message [不能为空]] ]
2022-08-21 23:24:14.261 DEBUG 4508 --- [nio-8888-exec-6] o.s.web.servlet.DispatcherServlet : Completed 400 BAD_REQUEST
2022-08-21 23:24:14.261 DEBUG 4508 --- [nio-8888-exec-6] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for POST "/demo/error", parameters={}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start from CustomerController.addCustomer and the logged MethodArgumentNotValidException for the javax.validation failure. Trace how the /demo/error request is handled and determine whether validation errors are converted to the project’s Response type. Done should be defined by an agreed response format and a test covering an invalid customerDTO.source value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100