Open adrian-haenni opened 1 year ago
@adrian-haenni thanks for reporting the issue. Do you mind doing a git bisect to identify the commit causing the issue?
@wing328 it was introduced in https://github.com/OpenAPITools/openapi-generator/pull/14179 in commit 9450984af84e02cdfc96560147e9f87c4bc381d9
the {{#variables}}
variable seem to be empty as well when generating the client.
@outscale-mdr can you please take a look at the issue when you've time? Thanks.
Probably the same for typescript-axios and still for java.
config.json:
{
"apiPackage": "api",
"modelPackage": "models",
"withInterfaces": true,
"withSeparateModelsAndApi": true,
"supportsES6": true,
"servers": [
{
"url": "http://{host}:{port}/",
"variables": {
"host": {
"default": "localhost"
},
"port": {
"default": "8000"
}
}
}
]
}
npx --yes @openapitools/openapi-generator-cli generate -i openapi.json -g typescript-axios -c config.json -o client --server-variables=host=localhost1,port=9999
Result (base.ts): export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
Bug Report Checklist
Description
When using the Maven plugin with "serverVariableOverrides" the generated API Client (ApiClient.java) does not have the variables mapping set.
openapi-generator version
Last working version was 6.2.1, subsequent versions have this issue (using okhttp-gson library).
OpenAPI declaration file content or url
Generation Details
The generated ApiClient then looks like this:
Then the issue arises in the buildUrl Method:
The baseUrl argument is null and the serverIndex class variable is not null, so it will create the base URL with
baseURL = servers.get(serverIndex).URL(serverVariables);
butserverVariables
is null. In consequence the resolved base url is{endpoint}/rest/
instead ofhttps://jira.domain.com/rest