[Please bear with me, I'm completely new to APIs, OpenAPI and Stoplight Studio.]
BACKGROUND FOR THE QUESTION
I am using Stoplight Studio to implement OpenAPI documentation for a POST request, which involves a file upload.
This is what my FormData looks like:
body:{"displayName":"exampleFileCSV","fields":[/*<<content from my fileupload>>*/]}
uploadFile: (binary)
This is what my Postman POST request looks like:
QUESTION:
I'm not able to figure out how to reproduce the same request in Stoplight Studio to document the API in OpenAPI. I need to configure the post request with the formData:{body, fileUpload}:
If that's not possible, I would like to know how it is implemented in swagger.json alone.
Though there is no way in stoplight studio to implement this, there is a SIMPLE SOLUTION to code it in swagger.json file.
schema:
type: string
format: binary
https://swagger.io/docs/specification/describing-request-body/file-upload/
You can define a property under content as string in stoplight studio and make the change of adding the 'format: binary' in swagger.json code. Stoplight studio will respect the change without overriding it.