Skip to content

[BUG][rust-axum] Generated Server fails to supply correct number of Generic Arguments in routing #21144

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

Open
5 of 6 tasks
Chrystalkey opened this issue Apr 25, 2025 · 0 comments

Comments

@Chrystalkey
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When Generating a spec in openapi-generator-cli version 7.12.0, The generator rust-axum fails to build a compiling module due to supplying the wrong number of generic arguments to the routing functions in src/server/mod.rs.
Such as:

.route("/api/v1/auth",
            delete(auth_delete::<I, A, E, C>).delete(auth_delete::<I, A, E>).post(auth_post::<I, A, E, C>).post(auth_post::<I, A, E>)
        )

Should be

.route("/api/v1/auth",
            delete(auth_delete::<I, A, E, C>).delete(auth_delete::<I, A, E, C>).post(auth_post::<I, A, E, C>).post(auth_post::<I, A, E>)
        )
openapi-generator version

7.12.0
rustc version 1.85

OpenAPI declaration file content or url

https://raw.githubusercontent.com/Chrystalkey/landtagszusammenfasser/refs/tags/rust-axum-body-wrapped/docs/specs/openapi.yml

Generation Details

java -jar "./oapi-generator/openapi-generator-cli.jar" generate -g rust-axum -i "$(Get-Location)/oapi-generator/openapi.yml" -o "$(Get-Location)/oapicode"
on linux replace with $(pwd)

Steps to reproduce
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > openapi-generator-cli
chmod u+x openapi-generator-cli
curl https://raw.githubusercontent.com/Chrystalkey/landtagszusammenfasser/refs/tags/rust-axum-body-wrapped/docs/specs/openapi.yml > openapi.yml
OPENAPI_GENERATOR_VERSION="7.12.0" ./$DIRECTORY/openapi-generator-cli generate -g rust-axum -i $DIRECTORY/openapi.yml -o $(pwd)/oapicode
cd oapicode
cargo build
Related issues/PRs

related/prestep to my issue tbd

Suggest a fix

This can be fixed by plainly grep-replacing <I, A, E> by <I, A, E, C>. With that the compilation of the module works.

@Chrystalkey Chrystalkey changed the title [BUG][rust-axum] Generated Client on Spec fails to supply correct number of Generic Arguments in routing [BUG][rust-axum] Generated Server fails to supply correct number of Generic Arguments in routing Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant