stoplightio / elements

Build beautiful, interactive API Docs with embeddable React or Web Components, powered by OpenAPI and Markdown.
https://stoplight.io/open-source/elements/
Apache License 2.0
1.64k stars 191 forks source link

Uploading a file is no longer possible with multipart/form-data #2263

Open pepawel opened 1 year ago

pepawel commented 1 year ago

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.

screenshot-localhost_3000-2022 10 11-21_06_08

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

  1. 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
  2. Open it with Elements.
  3. Observe lack of upload button for field named file.

Environment

kaperont commented 5 months ago

Any update on this?

kaperont commented 5 months ago

Is there a work-around in the meantime?

arno-fukuda commented 2 weeks ago

Looking for a workaround too.

This is important for our app.