Incorrect Usage of ResponseWrapper Instead of ResponderWrapper
darkyeg opened this issue · 3 comments
darkyeg commented
In the provided code snippet, there appears to be a typo in the usage of the type ResponseWrapper. It seems that ResponseWrapper should actually be ResponderWrapper according to the context.
Here's the corrected snippet:
if string_type == "impl Responder" {
is_responder = true;
*_type = Box::new(
match syn::parse2(quote!(
impl std::future::Future<Output=apistos::actix::ResponderWrapper<#_type>>
)) {
Ok(parsed) => parsed,
Err(e) => abort!("parsing impl trait: {:?}", e),
},
);
}
https://github.com/netwo-io/apistos/blob/main/apistos-gen/src/internal/mod.rs#L153
rlebran commented
Hi, thanks for the report.
Did you encounter any bug due to this ?
I will investigate the impact of the change.
darkyeg commented
Hi, thanks for the report.
Did you encounter any bug due to this ? I will investigate the impact of the change.
#[api_operation]
async fn test() -> impl Responder {
HttpResponse::Ok()
}
error[E0423]: expected function, tuple struct or tuple variant, found struct `apistos::actix::ResponseWrapper`
|
15 | #[api_operation]
| ^^^^^^^^^^^^^^^^
|
|
13 | pub struct ResponseWrapper<R, P> {
| -------------------------------- `apistos::actix::ResponseWrapper` defined here
...
59 | pub struct ResponderWrapper<T>(pub T);
| ------------------------------ similarly named tuple struct `ResponderWrapper` defined here
|
= note: this error originates in the attribute macro `api_operation` (in Nightly builds, run with -Z macro-backtrace for more info)
help: use struct literal syntax instead
|
15 | apistos::actix::ResponseWrapper { inner: val, path_item: val }
|
help: a tuple struct with a similar name exists
|
15 | ResponderWrapper
rlebran commented
Fix has been merged and will be available with version 0.2.1.
Thanks for the report !