-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Use std-uritemplate
instead of maintaining a separate implementation
#7
base: main
Are you sure you want to change the base?
Conversation
@@ -77,7 +77,7 @@ public void testSimpleStringExpansion() { | |||
assertEquals("one=1,two=2,three=3,comma=%2C", UriTemplate.of("{map*}").expandToString(variables)); | |||
assertEquals("", UriTemplate.of("{empty_map}").expandToString(variables)); | |||
assertEquals("", UriTemplate.of("{empty_map*}").expandToString(variables)); | |||
assertExpansionFailure("{list:1}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I belive this is a bug in the current implementation and the updated result is the expected one.
} | ||
return pos; | ||
} | ||
private List<String> extractTokens() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff in GH looks pretty ugly, anyhow, to respect the current option to throw an exception on missing keys (which is a usability "extra" on top of the original spec), I implemented a single pass extraction of the tokens as an additional validation step.
cc. @cescoffier |
@cescoffier @vietj are you interested into(ever) going down this path, or do you want me to close the PR? |
Polite ping |
@andreaTP sorry missed the pR? we need to evaluate your library |
@vietj let me know if I can help. The C# implementation is the most used uri template library on NuGet: |
👋 Hi there, and thanks for the great project!
This is a proposal that I'd like to evaluate with this project maintainers.
In the Kiota project we faced the challenge of having to support implementations of uri-template in various languages, for this and more motivations we ended up rolling out a new one: std-uritemplate .
More recently I created a Quarkus-Kiota extension and alternative libraries, as expected, the provided Http Client implementation for the Quarkus integration is based on VertX 🙂 .
Now, having two independent implementations of the same (simple)algorithm on the classpath doesn't surely hurt much the users, but, merging the efforts has a couple of pretty interesting benefits:
With this PR I'm tentatively spearheading the collaboration opportunity, showing the tradeoffs of the approach in it's practical implementation.
Additional notes:
talking about performance, in the early days of
std-uritemplate
I have been assisted by @franz1981 and I just updated a quick JMH benchmark to demonstrate that the two implementation have comparable results.Happy to hear your thoughts!