Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MethodValidationInterceptor support for Mono and Flux method parameters #20781

Closed
spring-projects-issues opened this issue Nov 26, 2017 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Sanjaya Kumar Patel opened SPR-16234 and commented

Traditionally (non-reactive), we had been doing method parameter validation as below:

@Validated
@Service
public class FooService

@Validated(SignUpValidation.class)
public void signup(@Valid UserCommand userCommand) {

    ...
}

In a reactive world, this might look like:

@Validated
@Service
public class FooService

@Validated(SignUpValidation.class)
public Mono<Void> signup(@Valid Mono<UserCommand> userCommand) {

    ...
}

But this is not working. So, in summary:

  1. Support for Mono and Flux is missing when using MethodValidationPostProcessor
  2. Also need support for validation groups (See @Validated(SignUpValidation.class) above)

Affects: 5.0.1

Reference URL: https://stackoverflow.com/questions/47244769/how-to-validate-mono-when-using-spring-reactive

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.x Backlog milestone Jan 11, 2019
@rstoyanchev
Copy link
Contributor

Note that @Valid is supported in WebFlux in combination with reactive types. This ticket I believe is mainly for MethodValidationPostProcessor and use of method-level Validated.

@rstoyanchev rstoyanchev added in: core Issues in core modules (aop, beans, core, context, expression) and removed in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 29, 2019
@jhoeller jhoeller self-assigned this Jan 30, 2019
@jhoeller jhoeller modified the milestones: 5.x Backlog, 5.3 M1 Sep 9, 2019
@jhoeller jhoeller modified the milestones: 5.3 M1, 5.3 M2 Feb 24, 2020
@jhoeller jhoeller modified the milestones: 5.3 M2, 5.x Backlog Jul 3, 2020
@fgolygo
Copy link

fgolygo commented Oct 8, 2020

Any update on that?

@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.0.x Nov 1, 2021
@jhoeller jhoeller modified the milestones: 6.0.x, 6.1.x Jan 11, 2023
@jhoeller jhoeller removed their assignment Feb 7, 2023
@rstoyanchev rstoyanchev modified the milestones: 6.1.x, 6.1.0-M3 Jul 10, 2023
@rstoyanchev rstoyanchev self-assigned this Jul 10, 2023
@jhoeller jhoeller modified the milestones: 6.1.0-M3, 6.1.0-M4 Jul 17, 2023
@rstoyanchev rstoyanchev modified the milestones: 6.1.0-M4, 6.1.0-RC1 Aug 2, 2023
@rstoyanchev rstoyanchev changed the title MethodValidationPostProcessor does not work with Mono and Flux method parameters [SPR-16234] MethodValidationInterceptor support for Mono and Flux method parameters Sep 6, 2023
@rstoyanchev
Copy link
Contributor

This is now supported by using doOnNext on the respective Mono and Flux in order to validate the actual values when they do materialize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants