Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support inline classes for API routes #101

Open
alexbezhan opened this issue Jun 2, 2021 · 3 comments
Open

Support inline classes for API routes #101

alexbezhan opened this issue Jun 2, 2021 · 3 comments

Comments

@alexbezhan
Copy link

alexbezhan commented Jun 2, 2021

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
Copy link
Collaborator

Wicpar commented Jun 6, 2021

You can't do inline data classes ?

@Wicpar
Copy link
Collaborator

Wicpar commented Jul 20, 2021

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
Copy link
Collaborator

Wicpar commented Jul 20, 2021

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

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

No branches or pull requests

2 participants