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

Introspect controller methods on startup to determine if they need validation #445

Closed
rstoyanchev opened this issue Jul 20, 2022 · 0 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Jul 20, 2022

There is a known issue with standard bean validation and Kotlin coroutine method, which we cannot address here, see #344, but as it stands our built-in support applies bean validation to every controller method as long as it's on the classpath. That means if you do want bean validation in some places, you can't opt out of it for coroutine methods even if they don't need it.

We should improve how the built-in validation support gets applied. For example, on startup, check if a controller method or its parameters has @Valid, or any other annotations marked with @Constraint. We'll also use Validator#getConstraintsForClass to check for constrained properties on complex Objects. Once we know what methods need validation, we'll use that at runtime to apply validation only where it is expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant