Use IntoUrl for more ergonomic function signatures#520
Merged
DanGould merged 3 commits intopayjoin:masterfrom Feb 19, 2025
Merged
Use IntoUrl for more ergonomic function signatures#520DanGould merged 3 commits intopayjoin:masterfrom
DanGould merged 3 commits intopayjoin:masterfrom
Conversation
Collaborator
Pull Request Test Coverage Report for Build 13360441514Details
💛 - Coveralls |
Collaborator
|
cACK, I don't think the complexity is too wild, and I agree 100% with this point:
Linking to reqwest::IntoUrl in the module-level documentation or even the commit message would help clearly point to the source of inspiration for our approach. |
spacebear21
reviewed
Jan 30, 2025
6d96be5 to
a0c8d74
Compare
Contributor
Author
|
Rather than link to the reqwest |
Contributor
Author
|
Blocking this until #522 is addressed |
DanGould
commented
Feb 16, 2025
Accept stringly types in typestate methods so that downstream implementations may depend on the typestate machines for URL parsing. This reduces a step for them and unifies our error handling for added internal complexity, which seems like the express purpose of the library. Create new ParseUrl error types in our state machines.
Removed gate is already inside a v2 feature module.
`use InternalSessionError::*;` is DRY.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re: #513
Inspired by
reqwest::IntoUrlAfter some consideration, I'm not sure if the goal really should be to remove
urltypes from the public API. That crate is ancient and has a stable release cadence and conservative MSRV targets (1.63 even with the latest) that we can track.However, I still think the
IntoUrlinterface makes our typestate machines easier to work downstream with for the tradeoff of added complexity in our crate.In order to graduate from DRAFT I'd need new error types for
extractfunctions that include aninto_url::Errorencapsulating variant. Before I do that work, I'm seeking a concept ack from @spacebear21 or otherwise a rejection of the idea, presumably on the grounds of too much complexity.Note, in payjoin-cli We're still validating URLs in configuration, and using the
url::Urlabstraction in function signatures makes more sense than becoming more loose for testing.The greatest advantage of this change may accrue to downstream FFI users, who I imagine use their native language's Url type and conversion to a stringly type that payjoin-ffi handles using IntoUrl rather than forcing them to use the
payjoin::Urlre-export and error handling.