is there a way to use data validation api – it all...
# http4k
v
is there a way to use data validation api – it allows to define constraints for OpenApi as well as validating input parameters:
Copy code
data class UpdateRequest(
        @get:Size(min = 0, max = 64)
        val name: String?,
        @get:Size(min = 0, max = 512)
        val bio: String?,
    )
d
not directly. We would always actually encode these rules in a custom type which is validated on construction using something like values4k. https://github.com/fork-handles/forkhandles/tree/trunk/values4k
(and yes, I am also involved with that lib)
v
would this help generating OpenApi doc as well?
hmm, I am afraid this wouldn't be as nice as the validation api
is it a good idea if I create an issue for that? this would be great if it was part of the lensing
d
You can if you like, but it will require someone to PR it in to get it working.. it would require custom annotations and alterations to the FieldLookup and Field/FieldMetadata
v
if you could write a tech spec how to implement it, I could try
d
TBH, it's probably going to be quite complicated. I'm not even sure how to spec if without doing most of the work.. 🙂
v
ok 😕
i will summarize it in an issue hoping that one day...