Raf Szałański
04/21/2022, 3:21 PMid: String
, name: String
and count: Int
and the caller forgets to send the count
or maybe sends a boolean there. When parsing such request, http4k will likely throw a lens failure, e.g:
body 'body' must be object
org.http4k.lens.LensFailure: body 'body' must be object
I found this piece of code recently https://github.com/http4k/http4k/blob/master/http4k-core/src/main/kotlin/org/http4k/lens/Validator.kt and thought it’d be fantastic to make it work with json parsing.
Unfortunately, I can only see it being used with web forms and not sure it works with json https://github.com/http4k/http4k/blob/master/http4k-core/src/test/kotlin/org/http4k/lens/ValidatorTest.ktValidator.Feedback
for json parsing but maybe I’m approaching the problem the wrong way?dave
04/22/2022, 4:08 PMRaf Szałański
04/22/2022, 4:10 PMdave
05/04/2022, 12:37 PM