pmcelhaney / counterfact

OpenAPI / Swagger to TypeScript generator and mock server
MIT License
88 stars 13 forks source link

Add Support for Binary Data in Responses #831

Open dethell opened 3 months ago

dethell commented 3 months ago

Per the OpenApi spec binary responses are allowed:

https://swagger.io/docs/specification/describing-responses/

v3 says to use "type": "string" but with "format": "binary". v2 says to use just "type": "file"

Not sure how best to have an endpoint load and respond with binary data but perhaps if a mock had base64 data in a string the endpoint could then decode it before returning the response.

pmcelhaney commented 3 months ago

Yeah I think it could be either a Base64 encoded string or a Blob or a stream.