OpenAPITools / OpenAPITools/openapi-generator
[BUG] openapi-generator-cli 6.0.1 swagger 2.0 to openapi 3.x conversion for multipart/form-data type: object missing
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Hi all,
I am currently struggeling with some conversion issue from a swagger 2.0 definition to the openapi 3.0.1
I have a upload route defined with this:
swagger: '2.0'
info:
version: 1.0.0
title: REST
description: A simple API
contact:
name: Just me
url: 'https://www..de'
basePath: /
schemes:
- https
consumes:
- application/json
produces:
- application/json
securityDefinitions:
AdminSecurity:
type: apiKey
in: header
name: Authorization
description: 'Admin'
paths:
/a:
post:
summary: Upload
description: Upload file
security:
- AdminSecurity: []
consumes:
- multipart/form-data
parameters:
- name: File
in: formData
type: file
description: The file
required: true
responses:
'200':
description: OK
'401':
description: Access denied
which gets converted to openapi 3 as:
openapi: 3.0.1
info:
contact:
name: Just me
url: https://www..de
description: A simple API
title: REST
version: 1.0.0
servers:
- url: /
paths:
/a:
post:
description: Upload file
requestBody:
content:
multipart/form-data:
schema:
properties:
File:
description: The file
format: binary
type: string
required:
- File
required: true
responses:
"200":
content: {}
description: OK
"401":
content: {}
description: Access denied - not authenticated
security:
- AdminSecurity: []
summary: Upload
components:
schemas: {}
securitySchemes:
AdminSecurity:
description: Admin
in: header
name: Authorization
type: apiKey
But from what I know there must be the type: object in openapi 3.
openapi: 3.0.1
info:
contact:
name: Just me
url: https://www..de
description: A simple API
title: REST
version: 1.0.0
servers:
- url: /
paths:
/a:
post:
description: Upload file
requestBody:
content:
multipart/form-data:
schema:
###########
type: object
###########
properties:
File:
description: The file
format: binary
type: string
required:
- File
required: true
responses:
"200":
content: {}
description: OK
"401":
content: {}
description: Access denied - not authenticated
security:
- AdminSecurity: []
summary: Upload
components:
schemas: {}
securitySchemes:
AdminSecurity:
description: Admin
in: header
name: Authorization
type: apiKey
Is this a known issue or is something wrong with my source definition?
I am using CLI version 6.0.1 with the follwing command:
java -jar openapi-generator-cli.jar generate -g openapi-yaml -i api.yaml -o test
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
Reproduce the conversion with openapi-generator-cli 6.0.1 using the supplied Swagger 2.0 input and generate command, then trace the Swagger-to-OpenAPI 3 conversion for multipart/form-data request schemas. Done means the generated schema includes type: object alongside the File property, with regression coverage for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100