OpenAPITools / OpenAPITools/openapi-generator
[BUG][Java] ApiClient.basePath is not a path but an URL
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
Description
The ApiClient generated for Java looks like this:
@Component("some.package")
public class ApiClient extends JavaTimeFormatter {
private boolean debugging = false;
private HttpHeaders defaultHeaders = new HttpHeaders();
private MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap();
private String basePath = "https://example.org";
// ...
with string-based getters and setters. But the naming is wrong imho. That's not a path but a (base) URL.
openapi-generator version
5.0.0-beta2
OpenAPI declaration file content or url
not required - use petstore
Generation Details
Steps to reproduce
Generate the petstore example for java, look at the ApiClient.
Related issues/PRs
Suggest a fix
- Rename into
baseUrlwithgetBaseUrlandsetBaseUrl. - Replace
Stringwithjava.net.URL- the only usage (in my case) seems to be inApiClient.buildUrl().
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
Generate the petstore example for Java and inspect the generated ApiClient, including its basePath accessors and the buildUrl usage. Confirm whether the intended fix is a naming change, a java.net.URL type change, or both; done means the generated client uses the agreed base URL API consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100