You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
With this spec
The generation of the client with openapi-generator-cli (OPENAPI_GENERATOR_VERSION=7.12.0) succeeds, but compilation with cargo build (rustc 1.85, 2024 edition) fails due to:
error[E0599]: the method `validate` exists for reference `&&Vec<String>`, but its trait bounds were not satisfied
--> oapicode\src\server\mod.rs:1508:14
|
1508 |#[derive(validator::Validate)]| ^^^^^^^^^^^^^^^^^^^
|
::: C:\Users\Benedikt\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib/rustlib/src/rust\library\alloc\src\vec\mod.rs:397:1
|
397 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {| ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<std::string::String>: Validate` | ::: C:\Users\Benedikt\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib/rustlib/src/rust\library\alloc\src\string.rs:362:1 |362 | pub struct String { | ----------------- doesn't satisfy `std::string::String: Validate`|
= note: the following trait bounds were not satisfied:
`Vec<std::string::String>: Validate`
which is required by `&Vec<std::string::String>: Validate``&Vec<std::string::String>: Validate`
which is required by `&&Vec<std::string::String>: Validate``std::string::String: Validate`
which is required by `Vec<std::string::String>: Validate``std::string::String: Validate`
which is required by `[std::string::String]: Validate`
= note: this error originates in the derive macro `validator::Validate` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0599`.
error: could not compile `openapi` (lib) due to 1 previous error
openapi-generator version
7.12.0
OpenAPI declaration file content or url
With Error https://raw.githubusercontent.com/Chrystalkey/landtagszusammenfasser/refs/tags/rust-axum-plain-string/docs/specs/openapi.yml Without Error https://github.com/Chrystalkey/landtagszusammenfasser/blob/rust-axum-body-wrapped/docs/specs/openapi.yml
Generation Details
with OPENAPI_GENERATOR_VERSION=7.12.0 set:
java -jar "./oapi-generator/openapi-generator-cli.jar" generate -g rust-axum -i "$(Get-Location)/openapi.yml"-o "$(Get-Location)/oapicode"
(on linux replace $(Get-Location) by $(pwd))
This is a bug that happens after the generic arguments in oapicode/src/server/mod are grep-replaced:
"<I, A, E>" -> "<I, A, E, C>"
There is a seperate issue for that, #21144
Suggest a fix
This is worked around (not fixed!) when wrapping the body of operationId: enum_put into an object:
Bug Report Checklist
Description
With this spec
The generation of the client with openapi-generator-cli (OPENAPI_GENERATOR_VERSION=7.12.0) succeeds, but compilation with cargo build (rustc 1.85, 2024 edition) fails due to:
openapi-generator version
7.12.0
OpenAPI declaration file content or url
With Error
https://raw.githubusercontent.com/Chrystalkey/landtagszusammenfasser/refs/tags/rust-axum-plain-string/docs/specs/openapi.yml
Without Error
https://github.com/Chrystalkey/landtagszusammenfasser/blob/rust-axum-body-wrapped/docs/specs/openapi.yml
Generation Details
with OPENAPI_GENERATOR_VERSION=7.12.0 set:
Steps to reproduce
with OPENAPI_GENERATOR_VERSION=7.12.0 set:
(on linux replace $(Get-Location) by $(pwd))
Related issues/PRs
This is a bug that happens after the generic arguments in oapicode/src/server/mod are grep-replaced:
"<I, A, E>" -> "<I, A, E, C>"
There is a seperate issue for that, #21144
Suggest a fix
This is worked around (not fixed!) when wrapping the body of operationId: enum_put into an object:
as was done in this version
However I still think this is an issue and should be possible just using plain strings.
The text was updated successfully, but these errors were encountered: