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

javax.validation API #541

Open
vojkny opened this issue Dec 10, 2020 · 0 comments
Open

javax.validation API #541

vojkny opened this issue Dec 10, 2020 · 0 comments

Comments

@vojkny
Copy link
Contributor

vojkny commented Dec 10, 2020

Spring MVC supports javax.validation annotations @Size, @Pattern which allows:

  1. Validate input fields on data classes (and respond with 400 in case of invalid payloads)
  2. Generate OpenApi/swagger docs, eg.:
    Screenshot 2020-12-10 at 14 52 55

These can be used on data classes as follows:

   data class User(
        @get:Size(min = 0, max = 64)
        val name: String?,
        @get:Size(min = 0, max = 512)
        val bio: String?,
    )

It would be great if http4k could get use of these annotations for both reasons above.

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

No branches or pull requests

1 participant