Closed
Description
Q&A
- OS: Windows
- Browser: Chrome
- Version: 117.0.5938.132
- Method of installation: npm
- Swagger-UI version: 5.4.2
- Swagger/OpenAPI version: OpenAPI 3.1.0
Content & configuration
With contentMediaType: application/octet-stream
instead
Example Swagger/OpenAPI definition:
# The Openapi 3.0 way
requestBody:
Document:
content:
multipart/form-data:
schema:
type: object
required:
- File
properties:
File:
type: string
format: binary
# The OpenAPI 3.1.0 way
requestBody:
Document:
content:
multipart/form-data:
schema:
type: object
required:
- File
properties:
File:
type: string
contentMediaType: application/octet-stream
Describe the bug you're encountering
This article from OpenAPI describes the conversion from OpenAPI 3.0 to 3.1.0 Migrating from OpenAPI 3.0 to 3.1.0.
For a file upload in 3.0 you would specify format: binary
. in 3.1.0 you now specify contentMediaType: application/octet-stream
instead. Swagger will only show the "Choose File" button if you have the format: binary
specified.
Expected behavior
I should be able to specify a schema like this and get the "Choose File" button
multipart/form-data:
schema:
type: object
required:
- File
properties:
File:
type: string
contentMediaType: application/octet-stream