swagger-api / swagger-api/swagger-codegen
[Java] Can't generate a ApiClient with specifying a default ReadTimeout
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I use maven builder with swagger-codegen to generate service client. But in my case, I want to specify some api with a default ReadTimeout within 3 secs. I don't want to code when new a ApiClient and set the readTimeout because it's a general config in many components. So base on SRP, I need to set a default value in ApiClient
Version
3.0.0-rc1
Suggest a fix/enhancement
public ApiClient() {
httpClient = new OkHttpClient();
httpClient.setReadTimeout($readTimeout)
...
}
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 Java ApiClient template used by swagger-codegen and the generated client's OkHttp setup. Check how generated client configuration is represented, then define what should be considered done for supplying a default read timeout and verify the generated client behavior with the relevant Maven tests, if available.
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
- 35/100