Open sklump opened 4 years ago
I'm looking for the exact same thing and I can't find a way to simply give the "type: file" value.
I'd like to produce this specification documented in the Swagger V2 documentation:
paths:
/logo:
get:
summary: Returns the logo image
produces:
- image/png
- image/gif
- image/jpeg
responses:
200:
description: OK
schema:
type: file
@sklump Did find an answer to this issue?
We have an admin API with a function to download a (binary) file.
This specification
fails on startup because the "schema" is not a Marshmallow schema:
Is there any way to mark a registered method to output OpenAPI docs specifying that its output is a binary file?
I've tried specifying an empty marshmallow schema like this
and then using the
@pre_load
/@post_load
/@pre_dump
/@post_dump
/@validates_schema
/@validate
decorators to populate the response schema with{"type": "string, "format": "binary"}
, but I can't get the server startup process to call them.I've tried specifying the type and format as
fields.Constant
in the response schema, but that is not correct either of course, as it specifies a JSON object withtype
andformat
attributes, not a binary file.Has anyone ever done this kind of thing? I would be very grateful for any advice.