I have gradle multimodule poject containing:
'api-spec' module which contains java interfaces of rest controllers to describe API specification with SpringDoc generator
'wallet' module which contains java classes of rest-controllers implementing api-spec interfaces
Consider I have:
'api-spec' module -> WalletController.java
@RequestMapping(path = "/wallet", produces = MediaType.APPLICATION_JSON_VALUE)
public interface WalletController {
@Operation(summary = "Create wallet")
@PostMapping(path = "/create-wallet")
ApiResponseContainer<WalletDto> createWallet(@Valid @RequestBody ApiRequestContainer<CreateWalletRequestDto> request);
}
'wallet' module -> WalletControllerImpl.java:
@RestController
@Slf4j
public class WalletControllerImpl implements WalletController {
@Override
public ApiResponseContainer<WalletDto> createWallet(ApiRequestContainer<CreateWalletRequestDto> request) {
/* validation does not perform in this case */
}
}
I expect Spring to validate the controller parameter exactly the same way when I create it in one class:
GoodController.java:
@RequestMapping(path = "/good")
public class GoodController {
@PostMapping
public ApiResponseContainer<SomeDto> someMethod(@Valid @RequestBody SomeBodyDto bodyDto) {
/* request is well validated here */
}
}
}
Does anybody face this issue?