papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
241 stars 42 forks source link

Support inline classes for API routes #101

Open alexbezhan opened 3 years ago

alexbezhan commented 3 years ago

Any chance to support inline classes for params? It would be good to avoid unnecessary allocations

    @JvmInline
    @Path("{email}")
    value class ByEmailPath(
        @PathParam("email") val email: String,
    )
API route with ByEmailPath must be a data class.
java.lang.AssertionError: API route with ByEmailPath must be a data class.
    at com.papsign.ktor.openapigen.parameters.util.UtilKt.buildParameterHandler(Util.kt:21)
    at com.papsign.ktor.openapigen.route.OpenAPIRoute.handle(OpenAPIRoute.kt:43)
    at com.papsign.ktor.openapigen.route.path.normal.NormalOpenAPIRoute.handle(NormalOpenAPIRoute.kt:36)
Wicpar commented 3 years ago

You can't do inline data classes ?

Wicpar commented 2 years ago

they are indee incompatible, if you want to implement them you need to add the logic to com/papsign/ktor/openapigen/parameters/util/Util.kt

Wicpar commented 2 years ago

in principle just the isData check could be removed to make it work