-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add backcompat stubs for optional header params #967
Changes from all commits
56b954a
eb77f79
0602a27
3dc1600
0a1240b
7209bde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: improvement | ||
improvement: | ||
description: When optional header params are added, Retrofit and Jersey generated | ||
code now includes deprecated methods without these headers - similar to those | ||
generated when optional query params are added. | ||
links: | ||
- https://github.com/palantir/conjure-java/pull/967 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,6 +224,21 @@ services: | |
type: optional<rid> | ||
param-type: query | ||
|
||
testOptionalHeaderParam: | ||
http: POST /test-optional-header-param | ||
args: | ||
query: string | ||
maybeHeader: | ||
type: optional<string> | ||
param-type: header | ||
param-id: MaybeHeader | ||
implicit: | ||
type: rid | ||
param-type: query | ||
maybeQuery: | ||
type: optional<rid> | ||
param-type: query | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example is generated into the suffixed files, but those are never compiled -- it would be helpful to define this somewhere that outputs into a source set that's also compiled for additional verification, otherwise duplicate methods with the same signature won't be caught by CI. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you have a place in mind where I could put this example? I think the cases where type clashes may cause the headers to not compile would be exactly when the first query param is optional and has the same type as any header param. This could be detected in code and worked around by not generating backcompat methods for header params if they would clash. It's likely a corner case in practice, but I appreciate that we need something that always compiles. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding it to a new service defined in ete-service.yml should provide compilation verification. Using a new service instead of an existing one means you won't need to update any resource implementations to stub the method. Is there danger in upgrading from an endpoint with an optional header to an endpoint with an optional header and optional query parameter that the same parameter index and type becomes used for another field? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess to be safe you'd want there to always be a non-optional param (of any kind) directly after the last optional header param. |
||
|
||
testBoolean: | ||
http: GET /boolean | ||
returns: boolean | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Unsure if you're aware, we have a helper function to update the expected output
./gradlew test -Drecreate=true
documented here