Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][PYTHON] Getting a file response in OpenAPI v3 / python #20979

Open
4 of 6 tasks
charlesfleche opened this issue Mar 26, 2025 · 0 comments
Open
4 of 6 tasks

[BUG][PYTHON] Getting a file response in OpenAPI v3 / python #20979

charlesfleche opened this issue Mar 26, 2025 · 0 comments

Comments

@charlesfleche
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I'm trying to define a file response:. 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.

Image

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

Image

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

openapi-generator version

7.11.0

OpenAPI declaration file content or url
openapi: 3.1.1
info:
  description: repro
  title: repro
  version: '1.0.0'
paths:
  /content:
    get:
      description: Returns data for all given object ids
      responses:
        '200':
          content:
            application/png:
              schema:
                type: string
                format: binary
          description: The file response
Generation Details
pip install openapi-generator-cli[jdk4py]
openapi-generator-cli.exe generate -i .\repro.yml -g python -o src
Steps to reproduce
Related issues/PRs
Suggest a fix
@charlesfleche charlesfleche changed the title [BUG][PYTHON] Description [BUG][PYTHON] Getting a file response in OpenAPI v3 / python Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant