Closed maximeborges closed 10 months ago
Hey, in short, no, we do not have a very good solution for this at the moment. A solution for this would be welcome.
Not sure how we should best go about implementing this. Ether we extend mount_endpoints_and_merged_docs
and/or openapi_get_routes
. But they might not be the right place to do this.
So yes, maybe creating a new macro that does the combining is the best solution.
I see you already took inspiration from both macro's. Feel free to create a MR. If the MR is created soon I might be able to add before the next release.
Closed because #138 was merged
@maximeborges Thanks for the MR. :heart: (and sorry for the delay)
Hello, I've been trying to nest routes in a somewhat clean way, but I couldn't manage to do that with the proposed macros. The idea is to include the routes from a module, adding a sub-path in the URI, and this module get more nested routes adding even more sub-path. All of that without having to specify all the routes at the top level (or second level by using
mount_endpoints_and_merged_docs
).It's a bit late here, so here is some code which might makes my explanation a bit more clear (hopefully), based on the
custom_schema
example: https://github.com/maximeborges/okapi/blob/ac9e23b6383591d8e9d69d742112679d163fa899/examples/nested/src/api/mod.rsBasically in the main:
and in the
api
module, which haspost
andmessage
as sub-module:Is there a better way of doing that, or should I propose a PR to have some function/macro for that?