You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have an endpoint (see yaml below) which has a body defined for a success, but a different body defined for an error response.
However, ApiInvoker expects a Manifest typed on the success response for all cases. The if statement on this case
) and you get the ConfigServiceError as a string (which isn't what you need).
A workaround is to use asInstanceOf to change the ApiRequest to be typed on the error type, but that isn't practical outside of testing.
openapi-generator version
4.3.0
OpenAPI declaration file content or url
openapi: '3.0.0'paths:
/api/v1/config/revision:
post:
summary: Add a revisiondescription: Add a revision of configuration without applying itrequestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RevisionRequest'responses:
'201':
description: Successcontent:
application/json:
schema:
$ref: '#/components/schemas/RevisionResponse''400':
description: BadRequestcontent:
application/json:
schema:
$ref: '#/components/schemas/ConfigServiceError'security:
- bearerAuth: []tags:
- configcomponents:
schemas:
ConfigServiceError:
description: A config service errortype: objectrequired:
- typeproperties:
type:
type: stringerrors:
type: arrayitems:
type: stringdescription: The errors
Command line used for generation
Scala, openapi-generator(4.3.0) (but code affected same in master)
sbt clean openapiGenerate
Steps to reproduce
Use an ApiInvoker typed on the success response in an error scenario, and try to unmarshall the error response.
Have the ApiInvoker and internal map take multiple types? Type the ApiResponse with multiple types (success/failure)? Remove/amend the if from the case statement?
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
We have an endpoint (see yaml below) which has a body defined for a success, but a different body defined for an error response.
However, ApiInvoker expects a Manifest typed on the success response for all cases. The if statement on this case
openapi-generator/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache
Line 251 in 26830bf
openapi-generator/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache
Line 260 in 26830bf
A workaround is to use asInstanceOf to change the ApiRequest to be typed on the error type, but that isn't practical outside of testing.
openapi-generator version
4.3.0
OpenAPI declaration file content or url
Command line used for generation
Scala, openapi-generator(4.3.0) (but code affected same in master)
sbt clean openapiGenerate
Steps to reproduce
Use an ApiInvoker typed on the success response in an error scenario, and try to unmarshall the error response.
Related issues/PRs
#1096
#316
#3377
Suggest a fix
Have the ApiInvoker and internal map take multiple types? Type the ApiResponse with multiple types (success/failure)? Remove/amend the if from the case statement?
The text was updated successfully, but these errors were encountered: