Redoc: Support request samples for JSON parts in multipart/form-data requests

Created on 10 Nov 2018  路  4Comments  路  Source: Redocly/redoc

We have an API with an endpoint that handles file uploads. The endpoint accepts multipart/form-data requests with two parts being a json content in the first part and binary file data in the second part.
We would like to give a request sample to the first (JSON) part.

We use openapi 3.0.0 spec, the request definition looks like this:

requestBody:
    required: true
    content:
        multipart/form-data:
            schema:
                type: object
                properties:
                    meta:
                        $ref: './meta.schema.json'
                    attachment:
                        type: string
                        format: binary
                        required: true
                required:
                - meta
                - attachment
            encoding:
                meta:
                    contentType: application/json; charset=utf-8

The meta schema contains an example, and it renders correctly if the request body is application/json.
Are we doing something wrong or ReDoc does not support our use case? Thanks!

enhancement feature

Most helpful comment

@RomanGotsiy Can I make PR to fix this issue? Because I need this feature too. Please, can you explain, what is the problem with it? And where I can fix that?
Thank you.

All 4 comments

You're doing nothing wrong. ReDoc just doesn't support your use case yet.

@RomanGotsiy Can I make PR to fix this issue? Because I need this feature too. Please, can you explain, what is the problem with it? And where I can fix that?
Thank you.

I am seeing the same issue described by gyszalai on Nov 10, 2018
Here is what i tried to do:

  1. npm install redoc --save . To reinstall Redoc. I still get the error.
  2. Attempted to use code from CDN () assuming that this had latest.

Is there a third way that I need to do this to get the fix?

I noticed that the PR that would supposedly implement support for this was closed without merging. Any reason for that?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonKohler picture JonKohler  路  3Comments

bmarwell picture bmarwell  路  3Comments

gavinkalika picture gavinkalika  路  3Comments

JFCote picture JFCote  路  3Comments

typekpb picture typekpb  路  4Comments