OpenAPITools / OpenAPITools/openapi-generator

[BUG][Java] templated servers broke simple setting of basepath

Open
#5,799 0 comments 2 reactions 0 assignees View on GitHub

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
  • What's the version of OpenAPI Generator used?
    4.3.0
  • Have you search for related issues/PRs?
    yes
Description

when the basepath for a generated api client is changed, that change get's ignored. cause is a check for

serverIndex != null

but the variable is initialized to 0

openapi-generator version

4.3.0 , yes. regression from 4.2.3

Related issues/PRs

probably introduced from https://github.com/OpenAPITools/openapi-generator/pull/4998

Suggest a fix

workaround is to either set the serverIndex to null explicitly, or add a single server configuration.

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 Java templated-server handling around the serverIndex != null check and compare the 4.3.0 regression with 4.2.3 and PR #4998. Verify that changing the basepath on a generated API client is honored without explicitly setting serverIndex to null or adding a server configuration.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.