The Ktor resources plugin doesn't seems to work wi...
# ktor
a
The Ktor resources plugin doesn't seems to work with post method function in routing and it work only after chaning the import, for more info is there any way to fix this workaround? it might causing bug as the import statement can be changed or removed in the future by other developers
a
What do you mean ”workaround”? Importing the required function is hardly a workaround 😅
👍 1
a
That's because you have to look at the imports and change manually change it, it can't be done by the IDE, there is another function with different import with automatically used, in the future you might remove it and there is no sign of error but it will cause a bug since that route won't work
At least that's the way how I see it (maybe it's just me but it doesn't matter), it doesn't has to be everyone perspective, I'm just wondering if there is a better solution
:)
a
Can you please file an issue about that?
a
Are you sure it's an issue (I'm not sure)?, you already closed the issue created by Artur Mkrtchian and update it as a question which was year ago
a
Resource route builders are not type-safe in the sense that they all accept
Any
, so all of the route handlers in
RoutingBuilder
with a single generic suffer from this ”issue” (post, put, patch). One way you can get it to fail at compile time is to use the undocumented
post<A, B>
with two generic arguments where A is your resource and B is the request body. It will always resolve to the correct import also.
👍 1
a
That's because it was a question and my recommendation helped solving the problem.
I mean the user's problem was solved.
a
Can you please file an issue about that?
So should I open a new issue?
a
Yes, please.
a
Sure