Skip to content

Conversation

@emilbonnek
Copy link

@emilbonnek emilbonnek commented Jan 7, 2026

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() 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.

Updates:

  • Updated all reqwest dependencies from ^0.12 to ^0.13
  • Added "query" and "form" to reqwest feature flags for all variants
  • BREAKING: Renamed feature rustls-tls to rustls to match reqwest 0.13's renamed feature

Why query feature is needed

The generated API code in api.mustache extensively uses req_builder.query() for handling query parameters. Without this feature flag, generated clients would fail to compile with reqwest 0.13.

Why form feature is needed

The generated API code uses req_builder.form() for URL-encoded form parameters. This feature is also required for compilation.

Breaking Change: rustls-tlsrustls

In reqwest 0.13, the rustls-tls feature was renamed to rustls. Generated clients now expose a rustls feature instead of rustls-tls for enabling rustls-based TLS support. Users who were enabling the rustls-tls feature will need to update their Cargo.toml to use rustls instead:

# Before (0.12)
your-api-client = { version = "...", features = ["rustls-tls"] }

# After (0.13)
your-api-client = { version = "...", features = ["rustls"] }

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.

  • Dependencies
    • Bumped reqwest to ^0.13 across blocking, async (with/without file streaming), and reqwest-trait variants.
    • Enabled "query" and "form" features for all configs; kept "json", "multipart", and "stream" where applicable.
    • Renamed "rustls-tls" feature to "rustls"; adjusted reqwest-middleware features (removed "blocking").
    • Added error conversion for reqwest_middleware’s re-exported reqwest::Error to fix builds with middleware and --all-features.

Written for commit 37ceac0. Summary will update on new commits.

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
Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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

@wing328
Copy link
Member

wing328 commented Jan 11, 2026

i've updated the samples via but the CI tests failed: #22664

can you please review when you've time?

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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"] }
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

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>
Suggested change
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] }
Fix with Cubic

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"] }
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

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>
Suggested change
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] }
Fix with Cubic

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"] }
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

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>
Suggested change
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] }
Fix with Cubic

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"] }
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

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>
Suggested change
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] }
Fix with Cubic

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"] }
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

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>
Suggested change
reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart", "query", "form"] }
reqwest = { version = "^0.13", default-features = false, features = ["json", "multipart"] }
Fix with Cubic

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"] }
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

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>
Suggested change
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart", "query", "form"] }
reqwest = { version = "^0.13", default-features = false, features = ["json", "blocking", "multipart"] }
Fix with Cubic

@emilbonnek
Copy link
Author

emilbonnek commented Jan 12, 2026

@cubic-dev-ai review seems wrong.

  • reqwest 0.13 introduced features "query" and "form".
  • "rustls-tls" feature is not used.

https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0

@wing328
CI check is passing now.

@wing328
Copy link
Member

wing328 commented Jan 13, 2026

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.
@emilbonnek
Copy link
Author

please review the build failure when you've time

I renamed the feature to rustls just like reqwest has done so that should fix it. And I updated the PR summary.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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"]
Copy link

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"]
Copy link

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>
Suggested change
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.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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.

Comment on lines +86 to +90
impl<T> From<reqwest_middleware::reqwest::Error> for Error<T> {
fn from(e: reqwest_middleware::reqwest::Error) -> Self {
Error::Reqwest(e)
}
}
Copy link

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>
Suggested change
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)
// }
// }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQ] [Rust] Build clients with reqwest 0.13

2 participants