-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[BUG][JAVA][JERSEY][CLIENT] (Auth parameter) API key is no longer added to query after version 4.3.1 (5.x+) #19573
Comments
I'm noticing this same thing with the okhttp-gson library, and the git history of its ApiClient.mustache looks like this change happened as part of #10858 which was part of the 5.3.1 release. And what is strange is that the rationale for that change was said to be the need to have more parameters to be able to pass to Authentication.applyToParams, and yet there isn't evidence in that PR that the extra parameters (payload, method, uri) are ever used by any implementation of Authentication. |
@jbrugge thanks for providing more details. can you please share your spec to start with? we will then take another look at the issue |
@wing328 Sure, here is the Swagger 2 spec set of files, As some context, we are moving from using swagger-codegen for a Java API client to openapi-generator as a first step before converting the spec to OpenAPI 3. At the moment I'm trying to get parity in the client with what we've gotten from swagger-codegen, and this issue is the latest hurdle. |
thanks for the info. I assume you've tried the latest version v7.9.0 and it still doesn't work for you, right? if you're using jersey2/3, can you please also try |
I had been using 7.8.0 with the |
thanks for confirming. closing this. happy to reopen if needed |
Bug Report Checklist
Description
I am trying to upgrade my project and its dependencies (from JDK 8 to JDK 21). However, when upgrading the openapi-generator-maven-plugin (currently 4.0.0) to any version 5 and above, the authentication with my web service fails.
I have tracked the issue down to the
ApiClient
'sinvokeApi
method, which used to runupdateParamsForAuth
to update the parameter lists as its first statement, but in newer versions it runs afterqueryParams
andcookieParams
have already been processed and thus any new values added to those lists are ignored. So the API key, which my WS expects to receive in the query, is not added.How does one use apiKey auth parameters in query now?
openapi-generator version
5.0.0 and higher
OpenAPI declaration file content or url
I hope this is enough of an example.
Generation Details
My openapi-generator-maven-plugin configuration:
This should be (largely) equivalent to:
Steps to reproduce
Well, code wise:
Where
UpdateApi.updateWithHttpInfo
is generated as:Before 5.0.0,
apiClient.invokeAPI
would create the correct queryhttps://mine.site.my/myWS/update?api_key={myKey}
before invoking it. From version 5.0.0 onwards, the issue described above occurs: the queryParams are processed, before being updated.Related issues/PRs
Don't know, I couldn't find any.
Suggest a fix
I don't even know if this is a bug, or intended, since it apparently has been like this for some time now.
The text was updated successfully, but these errors were encountered: