Enrico-git / WA2-EGLR

Laboratories and project of Web Application 2
0 stars 0 forks source link

is it possible to add @RestParam in TransactionDTO/receiverID and WalletDTO/id ? #4

Closed Enrico-git closed 3 years ago

Enrico-git commented 3 years ago

See "Request Validation" in https://medium.com/sprang/validation-and-exception-handling-with-spring-ba44b3ee0723

UPDATE: Maybe it's not possible: "... Where @RequestParam annotations can be used to make a parameter required or with default value, in command objects this is done with bean validation constraints like @NotNull and plain Java/Kotlin. To activate bean validation, the method argument has to be annotated with @Valid. When the bean validation fails, a BindException or WebExchangeBindException in the reactive stack is thrown. Both exceptions implement BindingResult, which provides nested errors for each invalid field value. Above controller method would result in error messages like... "

UPDATE: try to use @NotNull

UPDATE: How can be the DTO null? image