Open irevoire opened 1 month ago
This indeed has not been thought, and needs some assessment which can be addresses in future releases. Params directly in the nest
call could be considered if feasible. But is not something that can be quickly added.
However have you tried to define the param in the nest call and then the params in the path call?
#[derive(OpenApi)]
#[openapi(
nest(
(path = "/{foobar}", api = documents::DocumentsApi),
),
...
)]
// ... then in path
// Later on every route must specify the whole path:
#[utoipa::path(
get,
path = "/documents",
params(
("foobar" = String, Path, description = "foobar"),
),
tags = ["Indexes", "Documents"],
...
)]
Though this still requires users to define the parameter in each path
separately but should allow to define the parameter declaration in in the nest call. However I am not sure whether this actually works or does it give any benefits over declaring the path with with path param as well directly on the #[utoipa::path(...)]
Hey yes, this was the error I was receiving:
But after specifying that foobar was in the Path
it works.
Not ideal but yes it’s still better than nothing thanks!
Hello there! It’s me once again sorry
I’m still trying to use utoipa over the whole Meilisearch API and I found another bad corner case. Under the route
/indexes/{:indexUid}/documents/
we have a bunch of other routes thus I have a main openAPI structure that nest adocuments
openAPI structure. But I cannot specify the{:indexUid}
in it. It there a way to do that instead of not specifying any path and then specifying it in every sub route of thedocuments
struct?Is there a workaround I missed?
If not my proposal would be to define the parameter at the
nest
level like that: