Missing file browser in "Try it out" for multipart/form file uploads
See original GitHub issuePreviously (in OpenAPI 2.0), when creating an endpoint which takes a file upload via a multipart/form
POST
request, the Try it out
section in Swagger UI showed a Choose File
button to select a file from my harddisk which then got uploaded when clicking the execute
button.
Following the docs on how to do such uploads in OpenAPI 3.0.0, however, I am missing that button in Swagger UI and see a textbox instead with a JSON representation of the schema
.
Is that expected behaviour (as in not yet implemented for OpenAPI 3.0.0) or is the file upload in my API definition incorrectly written?
Q | A |
---|---|
Bug or feature request? | Could be both, depending on if this is expected behaviour |
Which Swagger/OpenAPI version? | OpenAPI 3.0.0 |
Which Swagger-UI version? | 3.3.2 |
How did you install Swagger-UI? | https://editor.swagger.io and self-hosted dist folder on nginx |
Which browser & version? | Chrome 62.0 & Opera 48.0 |
Which operating system? | Ubuntu 14.04 |
Demonstration API definition
Working example in OpenAPI 2.0:
swagger: '2.0'
info:
title: Some API
version: '1'
paths:
/conversion/nmea/geojson:
post:
consumes:
- multipart/form-data
parameters:
- in: formData
name: file
type: file
produces:
- text/plain
responses:
'200':
description: OK
schema:
type: string
example: "File upload successful"
Non-working example in OpenAPI 3.0.0:
openapi: 3.0.0
info:
title: Some API
version: "1"
paths:
/upload:
post:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
example: "File upload successful"
Expected Behavior
Current Behavior
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:9 (3 by maintainers)
Top Results From Across the Web
File upload on Swagger Editor OpenAPI 3 not showing the file ...
I need to document a route which consists of uploading an image. When attempting to "Try it out", I don't get the file...
Read more >File Upload - Swagger
Swagger 2.0 supports file uploads sent with Content-Type: multipart/form-data . That is, your API server must consume multipart/form-data for this operation:.
Read more >File Upload via Swagger - codeburst
The problem is not in the Swashbuckle.AspNetCore library but an issue in an upstream library, swagger-ui (issue #4600).) UPDATE 06/19/2020: Now multi files...
Read more >Handling file uploads - Manual - PHP
Sure if uploading a file is optional for a form then a user who uploads larger file will get no error and still...
Read more >How to Handle File Uploads from Node.js to Express - Twilio
Learn how to upload files by posting multipart/form-data from ... Node.js installed on your machine, along with a package manager like npm ...
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
I can say that the update worked for me
On Thu, Jul 12, 2018, 8:43 AM Ron notifications@github.com wrote:
@here - this has been implemented and is supposed to work (just tested it myself). If you encounter an issue, please file a new ticket with steps and details to help us investigate.