Skip to content

Comments

refactor(types)!: use string-based scheme over enum-based approach#6765

Merged
Xuanwo merged 10 commits intomainfrom
remove-scheme-enum
Nov 12, 2025
Merged

refactor(types)!: use string-based scheme over enum-based approach#6765
Xuanwo merged 10 commits intomainfrom
remove-scheme-enum

Conversation

@koushiro
Copy link
Member

@koushiro koushiro commented Nov 8, 2025

Which issue does this PR close?

Part of #6755

Rationale for this change

After merging #6764, the Scheme enum is no longer very useful, and is only used for the Operator::via_iter and Operator::via_map APIs. The via_map API has been replaced by via_iter and has been deprecated for a while, while the via_iter API is used more in test scenarios and bindings.

What changes are included in this PR?

  • remove Scheme enum usage from core
  • impl AsRef<str> for Scheme enum to avoid many breaking changes of bindings
  • use - instead of _ as the concatenation operator for multiple fields in the string-based scheme.

Are there any user-facing changes?

  • Operator::via_iter(scheme: Scheme, iter: impl IntoIterator<Item = (String, String)>) => Operator::via_iter(scheme: impl AsRef<str>, iter: impl IntoIterator<Item = (String, String)>)
  • Operator::via_map(scheme: Scheme, map: HashMap<String, String>) => Operator::via_map(scheme: impl AsRef<str>, map: HashMap<String, String>)
  • OperatorInfo::scheme(&self) -> Scheme => Operator::scheme(&self) -> &'static str

@koushiro
Copy link
Member Author

koushiro commented Nov 9, 2025

To avoid too many breaking changes to bindings, I don't want to remove the Scheme enum in this PR.

@koushiro koushiro marked this pull request as ready for review November 9, 2025 04:46
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" labels Nov 9, 2025
@Xuanwo Xuanwo changed the title refactor(types): use string-based scheme over enum-based approach refactor(types)!: use string-based scheme over enum-based approach Nov 11, 2025
@Xuanwo
Copy link
Member

Xuanwo commented Nov 11, 2025

Let's merge this PR after 0.55 been released.

@Xuanwo
Copy link
Member

Xuanwo commented Nov 12, 2025

Release failed anyways...

Let's merge now.

@@ -34,63 +33,66 @@ use crate::Error;
pub enum Scheme {
Copy link
Member

Choose a reason for hiding this comment

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

How about we change Scheme as a type alias to &'static str?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, some bindings still rely on the Scheme enum (like java bindings).
The current PR only removes the usage of the Scheme enum from the core.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, some bindings still rely on the Scheme enum (like java bindings). The current PR only removes the usage of the Scheme enum from the core.

Got it, we can finally remove them all in the future.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 12, 2025
@Xuanwo Xuanwo merged commit ce6a24a into main Nov 12, 2025
389 checks passed
@Xuanwo Xuanwo deleted the remove-scheme-enum branch November 12, 2025 09:47
@chitralverma
Copy link
Contributor

@koushiro seems like some changes will have to be done to the python bindings as well.
I'll take this up as part of #6748

@Xuanwo
Copy link
Member

Xuanwo commented Nov 12, 2025

@koushiro seems like some changes will have to be done to the python bindings as well. I'll take this up as part of #6748

Thank you!

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

Labels

lgtm This PR has been approved by a maintainer releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants