Forum Discussion

Stoplight's avatar
Stoplight
Community Manager
9 months ago

Multipart/form-data request body example

Originally posted by user Thien to the Stoplight Community on 11/01/2023 at 02:44 ET.

Hi everyone,

I have an API that is accepting a body of content type multipart/form-data.

In the request body, I am sending 2 parts, 1 part contains raw json, the other part contains a binary file.

curl --location --request POST 'https://my-site.com/documents' \
--header 'Authorization: Bearer xyz' \
--form 'files=@"document.pdf"' \
--form 'metadata="{
   "data": "data"
}"'

I am trying to add a json example, so that it autofill in the example cUrl.

But the json example that I added does not show in the documentation.

With the same OpenAPI yaml file, I can get Swagger to show the json example.

I tried googling and search here on discord but could not find any related information on how to make the json examples shown.

Does Stoplight not yet support showing json examples for multipart/form-data request body?

Or am I doing something wrong?

Thanks a bunch.