kurtbuilds / oasgen

Generates OpenAPI 3.0 spec based on Rust code. Works with axum, actix-web, or any/no framework.
https://crates.io/crates/oasgen
91 stars 7 forks source link

Support status codes with axum #23

Open musjj opened 1 day ago

musjj commented 1 day ago

Is it possible to use status codes with oasgen and have it automatically generate the appropriate openapi attributes?

async fn create_foo(Json(payload): Json<Foo>) -> impl IntoResponse {
    ...

    (StatusCode::CREATED, Json(payload))
}
kurtbuilds commented 1 day ago

Right now it doesn't, but I'd welcome a PR to implement this. The working fallback is to access/modify the OpenAPI object at runtime.