elements
elements copied to clipboard
Uploading a file is no longer possible with multipart/form-data
If I set field type to string
and format to binary
in requestBody, then Elements should render it as a field with file selector button.
However, currently it renders it as a normal text field.
There is a feature implemented by this PR, I saw screenshots of it (at least partly) working in this issue. So it seems the feature stopped working.
Context
Developers using API documentation are unable to test endpoints requiring file upload.
Current Behavior
The file field renders as a normal text field.
Expected Behavior
The file field should present file selector button.
Possible Workaround/Solution
I don't see any.
Steps to Reproduce
- Use following API spec:
openapi: 3.1.0
info:
title: Example
version: 0.1
servers:
- url: http://example.com
paths:
/api:
post:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
text_field:
type: string
file:
type: string
format: binary
- Open it with Elements.
- Observe lack of upload button for field named
file
.
Environment
- Version used: 7.7.2 (from https://www.npmjs.com/package/@stoplight/elements)
- Environment name and version: Node v16.17.1, React 17.0.2, Nextjs 12.
- Operating System and version: Pop!_OS 22.04 LTS
Any update on this?
Is there a work-around in the meantime?
Looking for a workaround too.
This is important for our app.