OpenAPITools / OpenAPITools/openapi-generator
[REQ] [Java] [okhttp-gson] Allow overriding tokenUrl in ApiClient constructor
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I have an openapi spec with a security section like:
securitySchemes:
mySecurityScheme:
type: oauth2
flows:
clientCredentials:
tokenUrl: https://example.com/token
I want to override tokenUrl at runtime. Currently the generated ApiClient class does not have a constructor or setter to allow overriding this value.
Describe the solution you'd like
A new ApiClient constructor that allows specifying tokenUrl.
The closest existing constructor is:
public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters)
We could have a new constructor with this signature:
public ApiClient(String basePath, String clientId, String clientSecret, String tokenUrl, Map<String, String> parameters)
(could possibly use URI instead of String for tokenUrl).
Describe alternatives you've considered
My current workaround is to extend ApiClient and create the new constructor in the subclass.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the generated Java okhttp-gson ApiClient and its existing constructor with basePath, clientId, clientSecret, and parameters. Add the requested constructor path so tokenUrl can be supplied at runtime, then verify that generated clients accept the value while preserving the existing constructor behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100