-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG][SPRING]compilation errors due to different request body type in api and apiDelegate files #3905
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
I'm experiencing the same problem with version 4.1.3 (in a JHipster API-first project). operation: /attachments:
post:
description: Creates a new Attachment by a file upload
operationId: createAttachment
requestBody:
content:
application/octet-stream:
schema:
$ref: '#/components/schemas/AttachmentFile' schema: AttachmentFile:
type: string
format: binary generated "...ApiDelegate" interface method: default ResponseEntity<Attachment> createAttachment(MultipartFile body) { ... } generated "...Api" interface method: default ResponseEntity<Attachment> createAttachment(@ApiParam(value = "" ) @Valid @RequestBody Resource body) {
return getDelegate().createAttachment(body);
} |
I'm dropping this workaround just in case: Define
and use
|
Life saver my guy, I've been looking all over for a workaround as this issue is still present in 5.4.0 |
Bug Report Checklist
Description
We have encountered this problem
generated Api and ApiDelegate files have different request body types (Resource/MultipartFile), which is resulting in compilation errors.
Issue seemed to have addressed in v4.0.0-beta3 version, but issue still persists when we tried with the cli version of v4.0.0-beta3.
openapi-generator version
v4.0.2
OpenAPI declaration file content or url
Command line used for generation
java -jar openapi-generator-cli.jar generate -g spring -i api.yml -o ./out --additional-properties delegatePattern=true
Steps to reproduce
foo
methodfoo
from FooApiDelegate consumesMultipartFile
whereas FooApi passesResource
as request body type.Related issues/PRs
Issue seemed to have addressed in v4.0.0-beta3 version per above PR, but issue still persists when we tried with the cli version of v4.0.0-beta3.
Suggest a fix
Use either Multipartfile or Resource in both api and apidelegate
The text was updated successfully, but these errors were encountered: