OpenAPITools / OpenAPITools/openapi-generator
[BUG] Incorrect example for java resttemplate client
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
README.md contains incorrect usage guide - it uses class "Configuration" which not generated by this generator (and some others, f.e. webclient).
Looks like usage guide is just copy-paste of "okhttp-gson" guide.
The main problem (from my point of view) that this guide included into generated artifact (I don't think that it's correct to use unexisted classes as exemple for delivered artifact usage)
To be honest I'm not sure what should be adjusted - guide or generator.
openapi-generator version
6.2.0
Steps to reproduce
Just take this example https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/java/resttemplate and try to impelemnt it step by step as in README.md
Suggest a fix
Change code in example from
ApiClient defaultClient = Configuration.getDefaultApiClient();
to
ApiClient defaultClient = new ApiClient();
Or adjust generators to produse such class. (Not sure that it's needed)
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 with samples/client/petstore/java/resttemplate/README.md and compare its Configuration-based example with the generated RestTemplate client shown in the sample. Reproduce the README steps, then update the guide or generator only after confirming which source produces the incorrect usage; done means the documented example uses classes present in the generated artifact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100