Bug Report Checklist
Description
@ThorinEk reported a problem the discussion on Issue 21587 that relates to the default case in the switch statement generated for a oneOf model when the model has a discriminator.
export function ExecuteCommandPostRequestToJSONTyped(value?: ExecuteCommandPostRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
switch (value['command']) {
... // removed
default:
// this should be return value since the variable json is undefined.
return json;
}
}
It looks like this bug was introduced in the PR for #20983
openapi-generator version
Latest master version
OpenAPI declaration file content or url
See OAS spec in this comment
Generation Details
Using typescript-fetch generator
Steps to reproduce
java -jar openapi-generator-cli.jar generate -g typescript-fetch -o output -i openapi-spec.json
Related issues/PRs
#21587 - bug mentioned here
#20983 - bug introduced
Suggest a fix
This should be a one line fix to change return json; to return value;
Bug Report Checklist
Description
@ThorinEk reported a problem the discussion on Issue 21587 that relates to the default case in the switch statement generated for a oneOf model when the model has a discriminator.
It looks like this bug was introduced in the PR for #20983
openapi-generator version
Latest master version
OpenAPI declaration file content or url
See OAS spec in this comment
Generation Details
Using typescript-fetch generator
Steps to reproduce
java -jar openapi-generator-cli.jar generate -g typescript-fetch -o output -i openapi-spec.jsonRelated issues/PRs
#21587 - bug mentioned here
#20983 - bug introduced
Suggest a fix
This should be a one line fix to change
return json;toreturn value;