swagger-api / swagger-api/swagger-codegen

[JAVA] Unable to modify the host without overwriting the whole base path

Open
#7,924 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The Java client base path includes the hostname (defaulting to localhost), as well as the rest of the base path defined in the yaml. The only method to set the base path overwrites everything, so I can't set the host without overwriting the rest of the basePath which I want to keep.

Swagger-codegen version

2.4.0

Swagger declaration file content or url
basePath: /v2
Steps to reproduce

Online editor, Java client: https://editor.swagger.io/

Produces basePath of http://petstore.swagger.io/v2 with no method available to change the petstore.swagger.io bit without also losing the v2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated Java client's base-path setter and the Java generation templates used by the online editor. Reproduce the generated client with basePath /v2, then determine how the hostname can be changed without removing /v2. Done means the generated client exposes that host-only change while preserving the declared base path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.