Closed ryadom closed 2 years ago
This example shows how you can device big projects into smaller parts (modules) and combine them into 1 openAPI structure. https://github.com/GREsau/okapi/tree/master/examples/custom_schema
It uses openapi_get_routes_spec!
(This is slightly different from openapi_get_routes
.) and mount_endpoints_and_merged_docs
.
There are also a few other macros since a few releases ago.
https://docs.rs/rocket_okapi/0.8.0-rc.1/rocket_okapi/index.html#macros
You can find more info about them higher on the page (between "Example" and "Re-exports")
If that does not fill the need, let me know.
You can also create your own macro like mount_endpoints_and_merged_docs
https://docs.rs/rocket_okapi/0.8.0-rc.1/src/rocket_okapi/lib.rs.html#154-179
But I created it a way that it allows for some flexibility.
It seems that it's exactly what I was looking for. Totally missed this example. Thanks for help!
It seems that it's hard to use openapi_get_routes in big projects. In order to use it I need one big list of all methods in the API. My rocket code is structured in the following way:
Having this structure it's hard to use openapi_get_routes! Is it possible to rewrite openapi_get_routes! as a runtime function that accepts Vec?