Skip to content

feat: add tls backend control through features to rust api client#443

Open
Alenar wants to merge 2 commits intoblockfrost:masterfrom
Alenar:master
Open

feat: add tls backend control through features to rust api client#443
Alenar wants to merge 2 commits intoblockfrost:masterfrom
Alenar:master

Conversation

@Alenar
Copy link
Copy Markdown

@Alenar Alenar commented Mar 16, 2026

Content

This PR add tls backend control through features to the rust api client.

This was done by upgrading the generator from 7.12.0 to 7.20.0 and regenerating the rust crate using yarn generate-types:rust.

Rational

At Mithril one of our current focus is switching all our binaries to static linking, for TLS we want to switch our backend from native-tls-vendored to rustls to remove all paths that build openssl but ... this blockfrost-openapi crate doesn't allow to control the features of its reqwest dependency as it is declared like this:

reqwest = { version = "^0.12", features = ["json", "multipart"] }

Meaning that it activate the default feature of reqwest which spread to our crates through the blockfrost crate.

Looking at the OpenApi generator project I found out that they added TLS backend control last year since version 7.13.0 and it was futher enhanced with later versions (e.g with configurable default backend in 7.17.0).

Additional impact

The generator also upgraded reqwest to 0.13+, which have some impacts (e.g. default backend switching from native-tls to rustls, rustls-tls feature renamed to rustls)

Another auto-generated change is the renaming of some enums variants from Array to ArrayVecString, I took a look at the blockfrost-rust crate and those variants were not used here, so it should be fine as long as third party crates are not using them (which I don't know).

Next

To allow full control of the TLS backend by child crates the blockfrost-rust Cargo.toml have to be updated to propagate the already available backend choice to the its blockfrost-openapi dependency.

A base patch could be this one:

diff --git a/Cargo.toml b/Cargo.toml
index f2843be..5a5231e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,10 @@ repository = "https://github.com/blockfrost/blockfrost-rust"
 homepage = "https://blockfrost.io"
 
 [dependencies]
-blockfrost-openapi = "0.1.83"
+blockfrost-openapi = { version = "0.1.84", default-features = false }
 futures = "0.3.31"
 futures-timer = "3.0.3"
-reqwest = { version = "0.12.9", default-features = false, features = [
+reqwest = { version = "0.13.2", default-features = false, features = [
     "http2",
     "charset",
     "macos-system-configuration",
@@ -32,7 +32,8 @@ tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
 
 [features]
 default = ["default-tls"]
-default-tls = ["reqwest/default-tls"]
+default-tls = ["reqwest/rustls-tls", "blockfrost-openapi/rustls"]
+native-tls = ["reqwest/native-tls", "blockfrost-openapi/native-tls"]
 rustls-tls = ["reqwest/rustls-tls"]
 rustls-tls-manual-roots = ["reqwest/rustls-tls-manual-roots"]
 rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"]

Several notes:

  • the blockfrost-openapi 0.1.84 version is tentative.
  • reqwest is upgraded to 0.13.2 to be consistent with the version now used in blockfrost-openapi
  • I added a native-tls feature since before native-tls backend could only be set though the default-tls feature which have changed to rustls
  • you may want to rename the rustls-tls feature to rustls like what reqwest did

I can do a PR on the blockfrost-rust repository but I feel that those choices are not neutral, so they should be made by core maintainers.

by upgrading the generator from `0.7.12` to `0.7.20`

This also upgrade `reqwest` to `0.13+`.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 16, 2026

@Alenar is attempting to deploy a commit to the Five Binaries IOG Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the generated Rust API client to allow selecting the reqwest TLS backend via crate features, enabled by upgrading the OpenAPI generator and regenerating the Rust crate.

Changes:

  • Upgrade OpenAPI generator configuration (7.12.0 → 7.20.0) and regenerate Rust client output.
  • Update Rust crate to reqwest ^0.13 with default-features = false and add native-tls / rustls crate features to control TLS backend.
  • Regenerated model changes include some public enum variant renames (e.g., ArrayArrayVecString).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
rust/src/models/signer_registrations_list_item_message.rs Regenerated model field ordering / doc adjustments.
rust/src/models/register_signer_message.rs Regenerated model field ordering / doc adjustments.
rust/src/models/asset_onchain_metadata_cip25_image.rs Regenerated enum variant rename affecting public API.
rust/src/models/asset_onchain_metadata_cip25_files_inner_src.rs Regenerated enum variant rename affecting public API.
rust/src/models/asset_onchain_metadata_cip25_description.rs Regenerated enum variant rename affecting public API.
rust/README.md Bumps recorded generator version in generated README.
rust/Cargo.toml Switch to reqwest ^0.13 and add TLS-backend selection features.
openapitools.json Bumps generator-cli version to 7.20.0.
Comments suppressed due to low confidence (1)

rust/README.md:224

  • This introduces new crate features (native-tls / rustls) to control the TLS backend, but the README doesn’t document how consumers should select them (including the need to use default-features = false when opting into rustls to avoid also pulling native-tls via the default feature). Please add a short note in the Installation section showing the intended Cargo dependency snippets.
- Generator version: 7.20.0
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`

## Installation


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
#[serde(untagged)]
pub enum AssetOnchainMetadataCip25FilesInnerSrc {
String(String),
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming this public enum variant (ArrayArrayVecString) is a breaking API change for downstream crates that pattern-match on the old variant. If this crate is published, please ensure the release/versioning reflects the breaking change (or provide a compatibility alias/deprecation path if you need to minimize churn).

Suggested change
String(String),
String(String),
/// Deprecated alias for `ArrayVecString` to preserve backward compatibility.
#[deprecated(note = "Variant `Array` has been renamed to `ArrayVecString`. Please update your code to use `AssetOnchainMetadataCip25FilesInnerSrc::ArrayVecString` instead.")]
Array(Vec<String>),

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

@Alenar Alenar Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also concerned about that breaking change, but this code was autogenerated by openapi-generator-cli.

Moreover this change was introduced by OpenAPITools/openapi-generator#21599 for a valid reason (multiple openapi array types could generated a variant with the Array name, leading to a name conflict).

Given the nature of issue solved, there's no way to configure the generator to add a Array variant for backward compatibility. It would have to be added manually which would be cumbersome to maintains since it would be removed each time the rust code is re-generated.

@@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
#[serde(untagged)]
pub enum AssetOnchainMetadataCip25Description {
String(String),
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming this public enum variant (ArrayArrayVecString) is a breaking API change for downstream crates that pattern-match on the old variant. If this crate is published, please ensure the release/versioning reflects the breaking change (or provide a compatibility alias/deprecation path if you need to minimize churn).

Suggested change
String(String),
String(String),
#[deprecated(note = "Renamed to `ArrayVecString`. This alias will be removed in a future major release.")]
Array(Vec<String>),

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as #443 (comment)

@@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
#[serde(untagged)]
pub enum AssetOnchainMetadataCip25Image {
String(String),
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming this public enum variant (ArrayArrayVecString) is a breaking API change for downstream crates that pattern-match on the old variant. If this crate is published, please ensure the release/versioning reflects the breaking change (or provide a compatibility alias/deprecation path if you need to minimize churn).

Suggested change
String(String),
String(String),
/// Deprecated: use `ArrayVecString` instead.
#[deprecated(note = "renamed to ArrayVecString to be more explicit; this alias will be removed in a future major release")]
Array(Vec<String>),

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as #443 (comment)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants