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
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When response type File is found in Swagger Def, it generates correct ApiResponse but does not include correct handling of Response body content as non json byte stream to type File.
"/rest/files/{id}/content": {"get": {"summary": "Download a file","description": "Download a file","tags": ["files"],"parameters": [{"in": "path","name": "id","required": true,"description": "The ID of the entity","type": "string"}],"responses": {"200": {"description": "File download request is successful","schema": {"type": "file"}},"401": {"description": "ERR_AUTH_UNAUTHORIZED\n"},"403": {"description": "ERR_ACCESS_USER\n\nERR_ENTITY_DELETED\n\nERR_ENTITY_DLP_LOCKED\n\nERR_ENTITY_IS_SECURE_FOLDER\n\nERR_ENTITY_NOT_SCANNED\n\nERR_ENTITY_VIRUS_FOUND"},"490": {"description": "Request blocked by WAF"}}}},
Bug Report Checklist
Description
When response type File is found in Swagger Def, it generates correct ApiResponse but does not include correct handling of Response body content as non json byte stream to type File.
It will read all bytes into String not checking the header
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache#L300
generates
openapi-generator version
Master / 7.13.0
OpenAPI declaration file content or url
Generation Details
https://github.com/qld-gov-au/kiteworks-integration
Steps to reproduce
Call a server endpoint that returns File as response. It throws exception.
Related issues/PRs
#19491
Suggest a fix
What should it do;
It should check the response header for what type of payload it received as well as check
returnType
for 'File' and handling accordingly.The text was updated successfully, but these errors were encountered: