Forum Discussion

charlesfleche's avatar
charlesfleche
Occasional Visitor
2 months ago

Getting a `file` response in OpenAPI v3 / python

I'm trying to define a `file` response:

responses:
'200':
  content:
     image/png:
       schema:
         format: binary
         type: string

 

In the generated python code, I see that for a file type, the function __deserialize_file is called, and it's exactly what I want: it save the HTTP response body as a temporary file on the filesystem and returns its path.

The problem is that the response_type file is never defined, it's always a bytearray.

How can I tell the python wrapper generator to write a file response to a temporary file (calling __deserialize_path) ?

Thanks !

No RepliesBe the first to reply