Bug Report Checklist
Description
I need to be able to address multiple objects based on status code. These could be errors objects, it could be different response objects. In the case here we have to success status code objects where each is linked to a 200 and a 202.
Swagger allows for multiple types, but the generated code seems to be blocking this additional path.
openapi-generator version
using npm
"@openapitools/openapi-generator-cli": "1.0.8-4.1.3",
OpenAPI declaration file content or url
"/submit": {
"post": {
"summary": "Order",
"description": "order to be processed.",
"operationId": "submitCartOrder",
"parameters": [
{
"name": "CartOrderSubmitRequestDto",
"required": true,
"in": "body",
"schema": {
"$ref": "#/definitions/CartOrderSubmitRequestDto"
}
}
],
"responses": {
"200": {
"description": "Order successfully submitted.",
"schema": {
"$ref": "#/definitions/OrderDetailDto"
}
},
"202": {
"description": "Order was successfully created but requires additional information to complete processing",
"schema": {
"$ref": "#/definitions/ServiceExceptionResponse"
}
},
"400": {
"description": "Failed to submit order."
}
},
"tags": [
"Cart"
],
"produces": [
"application/json"
],
"consumes": [
"application/json"
]
}
},
Command line used for generation
openapi-generator generate -g typescript-fetch -o .generated -i .swagger-spec.json
Steps to reproduce
after building the json swagger spec. I would run the command.
Related issues/PRs
#1562
Suggest a fix
Not the fix, but more like where the problem resides...
In the generated code, they all go to one translation type. It should be multiple.
const response = await this.request({
path: `/submit`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CartOrderSubmitRequestDtoToJSON(requestParameters.cartOrderSubmitRequestDto),
});
//This is the problem below, it's trying to do this for only 1 response type
return new runtime.JSONApiResponse(response, (jsonValue) => OrderDetailDtoFromJSON(jsonValue));
Bug Report Checklist
Description
I need to be able to address multiple objects based on status code. These could be errors objects, it could be different response objects. In the case here we have to success status code objects where each is linked to a
200and a202.Swagger allows for multiple types, but the generated code seems to be blocking this additional path.
openapi-generator version
using npm
"@openapitools/openapi-generator-cli": "1.0.8-4.1.3",
OpenAPI declaration file content or url
Command line used for generation
openapi-generator generate -g typescript-fetch -o .generated -i .swagger-spec.jsonSteps to reproduce
after building the json swagger spec. I would run the command.
Related issues/PRs
#1562
Suggest a fix
Not the fix, but more like where the problem resides...
In the generated code, they all go to one translation type. It should be multiple.