-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[Rust] Update reqwest dependency to 0.13 with query and form features #22630
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
base: master
Are you sure you want to change the base?
[Rust] Update reqwest dependency to 0.13 with query and form features #22630
Conversation
Update the Rust client generator template to use reqwest 0.13 instead of 0.12, as requested in issue OpenAPITools#22621. In reqwest 0.13, the `query()` and `form()` methods have been moved behind feature flags and are disabled by default. Since the generated Rust clients extensively use both methods, these features must be explicitly enabled. Changes: - Updated all reqwest dependencies from ^0.12 to ^0.13 - Added "query" and "form" to reqwest feature flags for all variants: - Blocking client configuration - Async client with file stream support - Async client without file stream - Reqwest-trait variant - Updated reqwest-middleware features for consistency This maintains full backward compatibility as only the dependency version and features change. The API surface of generated code remains identical. Fixes OpenAPITools#22621
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
|
i've updated the samples via but the CI tests failed: #22664 can you please review when you've time? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 issues found across 19 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml">
<violation number="1" location="samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml:14">
P1: reqwest 0.13 is configured with non-existent features `query` and `form`, causing Cargo feature resolution to fail</violation>
</file>
<file name="samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml">
<violation number="1" location="samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml:15">
P1: reqwest 0.13 is configured with non-existent features "query" and "form", which will cause Cargo feature resolution failures.</violation>
</file>
<file name="samples/client/others/rust/reqwest/oneOf/Cargo.toml">
<violation number="1" location="samples/client/others/rust/reqwest/oneOf/Cargo.toml:15">
P1: Reqwest 0.13 is configured with non-existent features `query`/`form`, causing a Cargo feature resolution build failure.</violation>
</file>
<file name="samples/client/others/rust/reqwest/composed-oneof/Cargo.toml">
<violation number="1" location="samples/client/others/rust/reqwest/composed-oneof/Cargo.toml:15">
P1: Reqwest configured with non-existent features (`query`, `form`) will fail Cargo feature resolution and prevent compilation.</violation>
</file>
<file name="samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml">
<violation number="1" location="samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml:15">
P1: Nonexistent reqwest features `query` and `form` will fail Cargo build</violation>
</file>
<file name="samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml">
<violation number="1" location="samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml:18">
P2: reqwest 0.13 renamed TLS feature `rustls-tls` to `rustls`; this crate still forwards `reqwest/rustls-tls`, so enabling the rustls feature now fails feature resolution/build</violation>
</file>
<file name="samples/client/others/rust/reqwest-regression-16119/Cargo.toml">
<violation number="1" location="samples/client/others/rust/reqwest-regression-16119/Cargo.toml:15">
P1: Cargo features `query` and `form` do not exist on reqwest; build will fail with unknown features.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| serde_repr = "^0.1" | ||
| url = "^2.5" | ||
| reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } | ||
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: reqwest 0.13 is configured with non-existent features query and form, causing Cargo feature resolution to fail
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml, line 14:
<comment>reqwest 0.13 is configured with non-existent features `query` and `form`, causing Cargo feature resolution to fail</comment>
<file context>
@@ -11,7 +11,7 @@ serde = { version = "^1.0", features = ["derive"] }
serde_repr = "^0.1"
url = "^2.5"
-reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] }
+reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
[features]
</file context>
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } | |
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] } |
| serde_repr = "^0.1" | ||
| url = "^2.5" | ||
| reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } | ||
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: reqwest 0.13 is configured with non-existent features "query" and "form", which will cause Cargo feature resolution failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml, line 15:
<comment>reqwest 0.13 is configured with non-existent features "query" and "form", which will cause Cargo feature resolution failures.</comment>
<file context>
@@ -12,7 +12,7 @@ serde = { version = "^1.0", features = ["derive"] }
serde_repr = "^0.1"
url = "^2.5"
-reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] }
+reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
[features]
</file context>
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } | |
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] } |
| serde_repr = "^0.1" | ||
| url = "^2.5" | ||
| reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } | ||
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Reqwest 0.13 is configured with non-existent features query/form, causing a Cargo feature resolution build failure.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/rust/reqwest/oneOf/Cargo.toml, line 15:
<comment>Reqwest 0.13 is configured with non-existent features `query`/`form`, causing a Cargo feature resolution build failure.</comment>
<file context>
@@ -12,7 +12,7 @@ serde = { version = "^1.0", features = ["derive"] }
serde_repr = "^0.1"
url = "^2.5"
-reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] }
+reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
[features]
</file context>
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } | |
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] } |
| serde_repr = "^0.1" | ||
| url = "^2.5" | ||
| reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } | ||
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Reqwest configured with non-existent features (query, form) will fail Cargo feature resolution and prevent compilation.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/rust/reqwest/composed-oneof/Cargo.toml, line 15:
<comment>Reqwest configured with non-existent features (`query`, `form`) will fail Cargo feature resolution and prevent compilation.</comment>
<file context>
@@ -12,7 +12,7 @@ serde = { version = "^1.0", features = ["derive"] }
serde_repr = "^0.1"
url = "^2.5"
-reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] }
+reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
[features]
</file context>
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } | |
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] } |
| serde_repr = "^0.1" | ||
| url = "^2.5" | ||
| reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart"] } | ||
| reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "query", "form"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Nonexistent reqwest features query and form will fail Cargo build
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml, line 15:
<comment>Nonexistent reqwest features `query` and `form` will fail Cargo build</comment>
<file context>
@@ -12,7 +12,7 @@ serde = { version = "^1.0", features = ["derive"] }
serde_repr = "^0.1"
url = "^2.5"
-reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart"] }
+reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "query", "form"] }
[features]
</file context>
| reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "query", "form"] } | |
| reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart"] } |
| serde_repr = "^0.1" | ||
| url = "^2.5" | ||
| reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] } | ||
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Cargo features query and form do not exist on reqwest; build will fail with unknown features.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/rust/reqwest-regression-16119/Cargo.toml, line 15:
<comment>Cargo features `query` and `form` do not exist on reqwest; build will fail with unknown features.</comment>
<file context>
@@ -12,7 +12,7 @@ serde = { version = "^1.0", features = ["derive"] }
serde_repr = "^0.1"
url = "^2.5"
-reqwest = { version = "^0.12", default-features = false, features = ["json", "blocking", "multipart"] }
+reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
[features]
</file context>
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] } | |
| reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] } |
|
@cubic-dev-ai review seems wrong.
https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0 @wing328 |
|
please review the build failure when you've time |
In reqwest 0.13, the rustls-tls feature was renamed to rustls. This updates the Cargo.mustache template and all generated samples to use the new feature name, fixing CI build failures when using --all-features flag.
I renamed the feature to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 20 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml">
<violation number="1" location="samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml:22">
P1: Wrong reqwest TLS feature name: `reqwest/rustls` is undefined, breaking `rustls` builds</violation>
</file>
<file name="samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml">
<violation number="1" location="samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml:20">
P1: Uses nonexistent reqwest feature `rustls`; should enable `rustls-tls` for Rustls support</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| default = ["native-tls"] | ||
| native-tls = ["reqwest/native-tls"] | ||
| rustls-tls = ["reqwest/rustls-tls"] | ||
| rustls = ["reqwest/rustls"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Wrong reqwest TLS feature name: reqwest/rustls is undefined, breaking rustls builds
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/rust/reqwest-trait/petstore/Cargo.toml, line 22:
<comment>Wrong reqwest TLS feature name: `reqwest/rustls` is undefined, breaking `rustls` builds</comment>
<file context>
@@ -19,5 +19,5 @@ mockall = { version = "^0.13", optional = true}
default = ["native-tls"]
native-tls = ["reqwest/native-tls"]
-rustls-tls = ["reqwest/rustls-tls"]
+rustls = ["reqwest/rustls"]
mockall = ["dep:mockall"]
</file context>
| default = ["native-tls"] | ||
| native-tls = ["reqwest/native-tls"] | ||
| rustls-tls = ["reqwest/rustls-tls"] | ||
| rustls = ["reqwest/rustls"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Uses nonexistent reqwest feature rustls; should enable rustls-tls for Rustls support
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml, line 20:
<comment>Uses nonexistent reqwest feature `rustls`; should enable `rustls-tls` for Rustls support</comment>
<file context>
@@ -17,4 +17,4 @@ reqwest = { version = "^0.13", default-features = false, features = ["json", "bl
default = ["native-tls"]
native-tls = ["reqwest/native-tls"]
-rustls-tls = ["reqwest/rustls-tls"]
+rustls = ["reqwest/rustls"]
</file context>
| rustls = ["reqwest/rustls"] | |
| rustls-tls = ["reqwest/rustls-tls"] |
…ypes When using reqwest_middleware, RequestBuilder::build() and Response methods return errors typed as reqwest_middleware::reqwest::Error (reqwest's Error re-exported through middleware). Added From impl to handle this module path. This fixes compilation errors when building with --all-features flag in middleware-enabled samples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="modules/openapi-generator/src/main/resources/rust/reqwest-trait/api_mod.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/rust/reqwest-trait/api_mod.mustache:86">
P1: Conflicting `From<reqwest_middleware::reqwest::Error>` impl duplicates existing `From<reqwest::Error>` (same type), causing E0119 or type mismatch</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| impl<T> From<reqwest_middleware::reqwest::Error> for Error<T> { | ||
| fn from(e: reqwest_middleware::reqwest::Error) -> Self { | ||
| Error::Reqwest(e) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Conflicting From<reqwest_middleware::reqwest::Error> impl duplicates existing From<reqwest::Error> (same type), causing E0119 or type mismatch
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/rust/reqwest-trait/api_mod.mustache, line 86:
<comment>Conflicting `From<reqwest_middleware::reqwest::Error>` impl duplicates existing `From<reqwest::Error>` (same type), causing E0119 or type mismatch</comment>
<file context>
@@ -82,6 +82,13 @@ impl<T> From<reqwest_middleware::Error> for Error<T> {
}
+// reqwest_middleware re-exports reqwest, so we need to handle both module paths
+impl<T> From<reqwest_middleware::reqwest::Error> for Error<T> {
+ fn from(e: reqwest_middleware::reqwest::Error) -> Self {
+ Error::Reqwest(e)
</file context>
| impl<T> From<reqwest_middleware::reqwest::Error> for Error<T> { | |
| fn from(e: reqwest_middleware::reqwest::Error) -> Self { | |
| Error::Reqwest(e) | |
| } | |
| } | |
| // reqwest_middleware already re-exports reqwest::Error; the existing From<reqwest::Error> covers it. | |
| // impl<T> From<reqwest_middleware::reqwest::Error> for Error<T> { | |
| // fn from(e: reqwest_middleware::reqwest::Error) -> Self { | |
| // Error::Reqwest(e) | |
| // } | |
| // } | |
Summary
This PR updates the Rust client generator template to use reqwest 0.13 instead of 0.12 (closes #22621).
Caution
I have not tested this with a real generated client yet.
Changes
In reqwest 0.13, the
query()andform()methods have been moved behind feature flags and are disabled by default. Since the generated Rust clients extensively use both methods, these features must be explicitly enabled.Updates:
^0.12to^0.13"query"and"form"to reqwest feature flags for all variantsrustls-tlstorustlsto match reqwest 0.13's renamed featureWhy
queryfeature is neededThe generated API code in
api.mustacheextensively usesreq_builder.query()for handling query parameters. Without this feature flag, generated clients would fail to compile with reqwest 0.13.Why
formfeature is neededThe generated API code uses
req_builder.form()for URL-encoded form parameters. This feature is also required for compilation.Breaking Change:
rustls-tls→rustlsIn reqwest 0.13, the
rustls-tlsfeature was renamed torustls. Generated clients now expose arustlsfeature instead ofrustls-tlsfor enabling rustls-based TLS support. Users who were enabling therustls-tlsfeature will need to update their Cargo.toml to userustlsinstead:Summary by cubic
Update the Rust client generator to use reqwest 0.13 and enable the query and form features so generated clients keep working with query params and URL-encoded forms. Closes #22621.
Written for commit 37ceac0. Summary will update on new commits.