Bug Report Checklist
Description
When an API uses the default response that has an object in it and no other responses, the generated code shows it as being returning a void
openapi-generator version
8.0.0-SNAPSHOT (and previous ones)
OpenAPI declaration file content or url
https://gist.github.com/toebes/55690b1c1176eec56a5140556532b471
Generation Details
- java -jar openapi-generator-cli.jar generate -i test1.json -o gentest1 --additional-properties=useobjectParameters=true -g typescript
- Look at
ObjectParamAIP.ts for the getPurchasesBAD and getPurchasesGOOD functions. Since the only difference between the swagger for the two is that getPurchasesGOOD has the default clause duplicated and changed to be 200, they should be the same, but the getPurchasesBAD is listed as returning void
/**
* This should be returning an object, not void.
* Summary of entry.
* @param param the request object
*/
public getPurchasesBADWithHttpInfo(param: DefaultApiGetPurchasesBADRequest = {}, options?: Configuration): Promise<HttpInfo<void>> {
return this.api.getPurchasesBADWithHttpInfo( options).toPromise();
}
/**
* This should be returning an object, not void.
* Summary of entry.
* @param param the request object
*/
public getPurchasesBAD(param: DefaultApiGetPurchasesBADRequest = {}, options?: Configuration): Promise<void> {
return this.api.getPurchasesBAD( options).toPromise();
}
/**
* This returns an object as expected.
* Get a list of all app purchases made by the current user.
* @param param the request object
*/
public getPurchasesGOODWithHttpInfo(param: DefaultApiGetPurchasesGOODRequest = {}, options?: Configuration): Promise<HttpInfo<GetPurchasesBADDefaultResponse>> {
return this.api.getPurchasesGOODWithHttpInfo( options).toPromise();
}
/**
* This returns an object as expected.
* Get a list of all app purchases made by the current user.
* @param param the request object
*/
public getPurchasesGOOD(param: DefaultApiGetPurchasesGOODRequest = {}, options?: Configuration): Promise<GetPurchasesBADDefaultResponse> {
return this.api.getPurchasesGOOD( options).toPromise();
}
Steps to reproduce
Using the test.json above and downloading the latest master:
java -jar openapi-generator-cli.jar generate -i test.json -o gentest -g typescript
Related issues/PRs
None found
Suggest a fix
In theory, the response.default should produce the same response as having both a response.200 and response.default. Given that the generated code returns GetPurchasesBADDefaultResponse indicates that it does expect the response for the two to be the same.
Bug Report Checklist
Description
When an API uses the default response that has an object in it and no other responses, the generated code shows it as being returning a void
openapi-generator version
8.0.0-SNAPSHOT (and previous ones)
OpenAPI declaration file content or url
https://gist.github.com/toebes/55690b1c1176eec56a5140556532b471
Generation Details
ObjectParamAIP.tsfor thegetPurchasesBADandgetPurchasesGOODfunctions. Since the only difference between the swagger for the two is thatgetPurchasesGOODhas the default clause duplicated and changed to be200, they should be the same, but thegetPurchasesBADis listed as returningvoidSteps to reproduce
Using the test.json above and downloading the latest master:
Related issues/PRs
None found
Suggest a fix
In theory, the response.default should produce the same response as having both a response.200 and response.default. Given that the generated code returns
GetPurchasesBADDefaultResponseindicates that it does expect the response for the two to be the same.