https://kotlinlang.org logo
#ktor
Title
# ktor
a

Alejandro Serrano Mena

01/18/2023, 7:07 PM
is there anything similar to type-safe routes, but for form parameters?
a

Alejandro Serrano Mena

01/19/2023, 8:20 AM
that explains query and path parameters, but says nothing about forms
a

Andrew O'Hara

01/19/2023, 3:09 PM
There also appears to be body validation, but not for forms: https://ktor.io/docs/request-validation.html. I don't see any 3rd party plugins, but they may exist. There's viartemev / ktor-validation-feature, but once again, it only seems to do non-form bodies. If it's very important to have built-in form validation, you may want to consider migrating to http4k in the mid to long term; it has a greater focus on type-safety in general. https://www.http4k.org/guide/howto/use_html_forms/
e

Emre

01/19/2023, 6:13 PM
@Andrew O'Hara any other strong reasons to prefer http4k?
a

Andrew O'Hara

01/19/2023, 6:44 PM
You might also prefer http4k if you want runtime OpenAPI generation, reflectionless type safety, serverless support, or a more function-oriented programming model. You may want to stick to Ktor if you value the shallower learning curve, larger support base, and superior content negotiation.
👍 1
20 Views