[BUG] [typescript-fetch] Base Path can't be set to '<empty string>'
Created by: duxiaofeng-github
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 https://github.com/OpenAPITools/openapi-generator/issues/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
https://github.com/OpenAPITools/openapi-generator/issues/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