- Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed as not planned
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another
Description
Given:
@Data @NoArgsConstructor @AllArgsConstructor @Builder public class VocabularyRequest { @Null(groups = CollectionCreation.class) @NotNull(groups = VocabularyCreation.class) private Long collectionId; @Valid private List<MeaningVariantRequest> meaningVariants; } This @Validated works:
@PostMapping(consumes = APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) @Override public Mono<VocabularyResponse> create( @Validated(VocabularyCreation.class) @RequestBody VocabularyRequest request) { return super.create(request); } But this (applied on a List) not:
@PostMapping(value = "/bulk", consumes = APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) @Validated(VocabularyCreation.class) public Flux<VocabularyResponse> createBatch( @RequestBody List<@Valid VocabularyRequest> requests) { return service(VocabularyService.class).createBatch(requests); } Change to this, still not work:
@PostMapping(value = "/bulk", consumes = APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public Flux<VocabularyResponse> createBatch( @Validated(VocabularyCreation.class) @RequestBody List<VocabularyRequest> requests) { return service(VocabularyService.class).createBatch(requests); } If changing to @RequestBody List<@Validated(VocabularyCreation.class) VocabularyRequest> requests, got compile error:
'@Validated' not applicable to type use
NOTE: By "not working", I mean validation group not working. Not sure if @Valid works or not since I didnot observe it
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another