-
Notifications
You must be signed in to change notification settings - Fork 16
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
Utility to safely build URLs #346
Conversation
Generate changelog in
|
import com.palantir.dialogue.UrlBuilder; | ||
import java.net.URL; | ||
|
||
/** Convenience utility around {@link UrlBuilder}. */ |
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.
Why not add the render method to UrlBuilder?
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’m worried about introducing bugs that mutate the urlBuilder state
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.
Method on the builder is probably fine but it adds logic to the generator target rather than the runtime, and we still risk mutation
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.
Sure...it just seems strange to fully encapsulate one utility class inside another. After this change UrlBuilder wouldn't need to be public, right?
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 generated Endpoint objects have a method that consumes a UrlBuilder. I think that object should become an interface to further reduce logic in the generator target API, but that can occur separately.
Deduplicate client code, and isolate unsafety around UrlBuilder mutability.
578d2c6
to
dcdd376
Compare
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.
👍 Changing UrlBuilder from a class to interface is an ABI break but it shouldn't be an issue. Now might be the right time to make any breaks that require changes to the codegen
👍 policy bot? |
🤖 |
👍 |
Deduplicate client code, and isolate unsafety around UrlBuilder
mutability.
After this PR
==COMMIT_MSG==
Utility to safely build URLs
==COMMIT_MSG==