Skip to content

[BUG] [typescript-fetch] Base Path can't be set to '<empty string>' #5282

@dev-johnny-gh

Description

@dev-johnny-gh

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

the same issue with #2731

openapi-generator version

latest version

Steps to reproduce
new DefaultApi(
  new Configuration({
    basePath: "",
  }),
)

the basePath will replaced by "localhost/xxxx", but i expect it as /xxxx

Related issues/PRs

#2731

Suggest a fix

it caused by this line:

the code above assume that this.configuration.basePath not a empty string, otherwise it will be replaced by BASE_PATH.

use the below code to fix it:

return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;

it means if this.configuration.basePath NOT A NULL OR UNDEFINED, then use it, otherwise use the BASE_PATH

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions