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 OpenAI path not merging when combining multiple impl OpenApi #923

Open
lucemans opened this issue Dec 8, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@lucemans
Copy link

lucemans commented Dec 8, 2024

Expected Behavior

Routes should be combined when they have different methods but the same path

Actual Behavior

Only the last route is included in the openapi output
All previous routes are omitted.

Steps to Reproduce the Problem

Sample code

Suppose we have the following routes and wanted to split them up into seperate files.

POST /user
PATCH /user
pub struct UserEditApi;

#[OpenApi]
impl UserEditApi {
    #[oai(path = "/user", method = "patch")]
    async fn edit_user(&self) -> Result<()> {
        Ok(())
    }
}

pub struct UserCreateApi;

#[OpenApi]
impl UserPostApi {
    #[oai(path = "/user", method = "patch")]
    async fn edit_user(&self) -> Result<()> {
        Ok(())
    }
}

And then when running our app

fn get_api() -> impl OpenApi {(
  UserEditApi,
  UserPostApi,
)}

// In main function
OpenApiService::new(get_api(), "Hello World", "1.0").server("http://localhost:3000");

Specifications

  • Version:
  • Platform:
  • Subsystem:
@lucemans lucemans added the bug Something isn't working label Dec 8, 2024
@rsfunc
Copy link

rsfunc commented Jan 5, 2025

I guess this duplicates mine: #698

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