OpenAPITools / OpenAPITools/openapi-generator
[BUG] Swagger UI doesn't recognize file inputs when generating with jaxrs-jersey
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Swagger UI doesn't recognize file inputs when using using the Maven plugin(openapi-generator-maven-plugin) with generator jaxrs-jersey.
This worked for version 4.3.0, but doesn't work for version 5.1.0 or 6.0.0-SNAPSHOT
I've used the latest version of Swagger UI.
openapi-generator version
5.1.0 (Worked on 4.3.0)
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: File upload demo
version: 1.0.0
servers:
- url: http://localhost:9999/api
components:
schemas:
Dummy:
type: object
properties:
key:
type: string
value:
type: string
paths:
/fileuploadMultiPart:
post:
description: Mulitpart file upload
operationId: fileUploadMultipart
requestBody:
content:
multipart/form-data:
schema:
type: object
required:
- definitionFile
properties:
definitionFile:
maxLength: 5000000
minLength: 1
type: string
description: Definition file
format: binary
required: true
responses:
201:
description: Multipart upload response
content: { }
Generation Details
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/fileupload-demo.yaml</inputSpec>
<generatorName>jaxrs-jersey</generatorName>
<modelNameSuffix>DTO</modelNameSuffix>
<modelPackage>com.mmab.soldr.api.swagger.model</modelPackage>
<apiPackage>com.mmab.soldr.api.swagger</apiPackage>
<invokerPackage>com.mmab.soldr.api.swagger</invokerPackage>
<generateModels>true</generateModels>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
I have made a repo to reproduce and demonstrate the problem:
https://github.com/Eskas/openapi-swagger-ui-fileupload-demo/
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied OpenAPI 3.0.3 declaration and Maven plugin configuration, or the linked reproduction repository, and generate jaxrs-jersey output with 5.1.0 or 6.0.0-SNAPSHOT. Compare the generated multipart endpoint and Swagger UI behavior with version 4.3.0; done means the definitionFile upload is recognized as it was in 4.3.0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100