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
[Rust] Configurable default features from reqwest dependency (#22041)
* fix(rust): Remove default features from reqwest dependency
This change removes the default features (specifically native-tls) from the reqwest
dependency in the Rust client generator. This allows users to explicitly choose
their TLS backend without automatically including openssl-sys as a transitive dependency.
Users can now explicitly enable TLS backends using feature flags:
- native-tls
- rustls-tls
- default-tls
Fixes#21933
* feat(rust): Add reqwestDefaultFeatures option with backward-compatible default
This change adds a new generator option `reqwestDefaultFeatures` that allows
users to configure the default Cargo features for the reqwest dependency.
The option accepts:
- An array of strings in YAML config: reqwestDefaultFeatures: ["native-tls"]
- A comma-separated string via CLI: --additional-properties=reqwestDefaultFeatures=native-tls
- An empty value for no defaults: reqwestDefaultFeatures: []
Default value: ["native-tls"] (maintains backward compatibility)
This addresses the feedback in #21933 to make the change opt-in rather than
breaking existing users.
Users can now:
- Keep the current behavior (default)
- Opt-out: reqwestDefaultFeatures: []
- Use alternative TLS: reqwestDefaultFeatures: ["rustls-tls"]
- Combine features: reqwestDefaultFeatures: ["native-tls", "cookies"]
Fixes#21933
Copy file name to clipboardExpand all lines: docs/generators/rust.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
27
27
|packageName|Rust package name (convention: lowercase).||openapi|
28
28
|packageVersion|Rust package version.||1.0.0|
29
29
|preferUnsignedInt|Prefer unsigned integers where minimum value is >= 0||false|
30
+
|reqwestDefaultFeatures|Default features for the reqwest dependency (comma-separated). Use empty for no defaults. This option is for 'reqwest' and 'reqwest-trait' library only.||native-tls|
30
31
|supportAsync|If set, generate async function call instead. This option is for 'reqwest' library only||true|
31
32
|supportMiddleware|If set, add support for reqwest-middleware. This option is for 'reqwest' and 'reqwest-trait' library only||false|
32
33
|supportMultipleResponses|If set, return type wraps an enum of all possible 2xx schemas. This option is for 'reqwest' and 'reqwest-trait' library only||false|
cliOptions.add(newCliOption(BON_BUILDER, "Use the bon crate for building parameter types. This option is for the 'reqwest-trait' library only", SchemaTypeUtil.BOOLEAN_TYPE)
229
231
.defaultValue(Boolean.FALSE.toString()));
232
+
cliOptions.add(newCliOption(REQWEST_DEFAULT_FEATURES, "Default features for the reqwest dependency (comma-separated). Use empty for no defaults. This option is for 'reqwest' and 'reqwest-trait' library only.")
0 commit comments