[BUG][Java][Spring] multiple files upload
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What’s the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What’s the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
use open api spec 3 to define api to upload multiple files, but openapi generator generate incorrect, following openapi spec
https://swagger.io/specification/#mediaTypeObject
section: “To upload multiple files, a multipart media type MUST be used:”
default ResponseEntity<Document> createDocument(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "") @RequestParam(value="metadata", required=false) Object metadata)
should be array: MultipartFile[] file
default ResponseEntity<Document> createDocument(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile[] file,@ApiParam(value = "") @RequestParam(value="metadata", required=false) Object metadata)
openapi-generator version
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator</artifactId>
<version>4.2.2</version>
</dependency>
OpenAPI declaration file content or url
openapi: "3.0.2"
info:
version: "1.0.0"
title: "File Management API"
description: >-
File Management
paths:
/api/v1/documents:
post:
tags:
- Manage Files
summary: "Upload new file"
operationId: "createDocument"
requestBody:
content:
multipart/form-data:
schema:
properties:
file:
type: array
items:
type: string
format: binary
metadata:
type: object
responses:
201:
description: "Document created, return generated document information"
404:
description: "Not Found"
409:
description: "Conflict"
500:
description: "Internal Server Error"
Command line used for generation
Steps to reproduce
Related issues/PRs
looks like there are similar issues, not sure if it fixed or not.
https://github.com/OpenAPITools/openapi-generator/issues/2210 https://github.com/ga4gh/workflow-execution-service-schemas/issues/43
Suggest a fix
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How to upload multiple files in Java Spring Boot - BezKoder
In this tutorial, I will show you how to upload multiple files and download with a Spring Boot Rest APIs. We also use...
Read more >Uploading multiple files does not work in spring boot controller
I can upload one file to a spring boot ...
Read more >Uploading Multiple Files with Spring Boot - Daily Code Buffer
Multipart-file requests break large files into smaller chunks which makes it efficient for file uploads. More information about it can be found here....
Read more >Upload Multiple Files in Spring Boot using JPA, Thymeleaf ...
In this article, we will learn how to upload multiple files to the server with the help of Spring boot. So to make...
Read more >Spring Boot Upload Multiple Files Example - CodeJava.net
In this post, I will share some code examples demonstrating uploading multiple files in a Java web application based on Spring Boot.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
How can I solve the same problem with multiple files upload for
typescript-axios
generator? I tried@openapitools/openapi-generator-cli@cli-5.0.0-beta
on this scheme:It don’t take into account the array of files and generates this code:
It would be great if it produce something like:
Or maybe I’m doing something wrong?
Hello,
I have the same problem. Java client not work for me.
I used the previously defined file