-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Java][Retrofit] fix wrong order of path params #6796
[Java][Retrofit] fix wrong order of path params #6796
Conversation
03bdd6b
to
a93bd54
Compare
@@ -76,33 +76,6 @@ public void testFindPetsByStatus() throws Exception { | |||
} | |||
|
|||
@Test | |||
public void testFindPetsByTags() throws Exception { |
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.
@giuliopulina May I know why the test cases for findPetsByTags
are removed? Is it throwing errors when run locally?
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.
@wing328 Yes, I confirm that mvn integration-test was throwing error.
In fact, if I try to call the service: http:https://petstore.swagger.io/v2/pet/findByTags?tags=friendly
I receive this error:
<apiResponse>
<message>something bad happened</message>
<type>unknown</type>
</apiResponse>
And also, if I look in swagger UI, I see that this endpoint is deprecated:
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 CIs (Travis, CircleCI) are running a local copy of the Petstore server as the public petstore server contains invalid pet data from time to time (since anyone can update the record).
Please add those tests back and the CI tests should pass.
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.
done 👍
a93bd54
to
8506f7a
Compare
… defined after @query params
8506f7a
to
9126ed6
Compare
@giuliopulina I did some tests locally and the result is good. Thanks for the PR. |
thanks a lot for your work :) |
I have a related question regarding operations path params specifically: does anyone think that we should enforce path params order based on how they appear in on the URL path instead of relying on the order in the For instance when the URL path is "/accounts/{accountId}/users/{userId}" and
the generated method will have a signature that looks like |
Hi @mmallis87 for what my opinion may be worth, I think it can make sense: however, I think this behavior should be aligned between all the different generators, not just for the Retrofit one, so it should be an higher level design decision. |
@giuliopulina I agree that this type of change should be aligned across all generators since it's not specific to Java or Retrofit. |
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.3.0.0
branch for changes related to OpenAPI spec 3.0. Default:master
.Fixes #6391: retrofit2 is crashing when @query params are defined before @path param in the api.
With this change, params are correctly reordered (@path param are always defined before @query param).
(details of the change, additional tests that have been done, reference to the issue for tracking, etc)
@bbdouglas @JFCote @sreeshas @jfiala @lukoyanov @cbornet