Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poem-openapi: operation_id doesn't work with transform #405

Closed
DDtKey opened this issue Oct 6, 2022 · 1 comment
Closed

poem-openapi: operation_id doesn't work with transform #405

DDtKey opened this issue Oct 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@DDtKey
Copy link
Contributor

DDtKey commented Oct 6, 2022

Expected Behavior

I want to specify operation_id& add transform to my endpoint.
The code below should work fine:

struct Api;

#[OpenApi]
impl Api {
    #[oai(path = "/hello", method = "get", operation_id = "hello", transform = "my_transformer")]
    async fn index(&self) -> PlainText<String> {
        PlainText(format!("hello, world!"))
    }
}

fn my_transformer(ep: impl Endpoint) -> impl Endpoint {
    ep.with(MyMiddleware::new())
}

Actual Behavior

It returns error:

error[E0599]: no method named `set_data` found for mutable reference `&mut <impl poem::Endpoint as poem::Endpoint>::Output` in the current scope

| #[OpenApi]
| ^^^^^^^^^ method not found in `&mut <impl poem::Endpoint as poem::Endpoint>::Output`

Looks like it was broken after #351
It perfectly works on poem-openapi 2.0.7

Specifications

  • Version: poem: 1.3.45 + poem-openapi: 2.0.15
@DDtKey DDtKey added the bug Something isn't working label Oct 6, 2022
@sunli829
Copy link
Collaborator

sunli829 commented Oct 7, 2022

Fixed in v2.0.16 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants