Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Support array of format: binary items in multipart/form-data request bodies

Open
#1,255 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
openapi, python
Domain
api, tooling

Research direction

Start by tracing the generator path that handles multipart/form-data request bodies and compare it with the generated sync_detailed(...) method described in the issue. Verify the generated client sends the files field as multipart data rather than through httpx json=, and add coverage for the supplied OpenAPI schema if the repository has a relevant generator test location.

Written by the indexing model from the issue text.

Description

Describe the bug
When an OpenAPI 3.0 schema defines a property as an array of binaries inside a multipart/form-data requestBody, the generator currently treats it as a JSON body and emits a single body parameter. As a result:

  • The generated sync_detailed(...) signature has only:
def sync_detailed(
    *,
    client: Client,
    body: UploadFilesPostBody,
    hash_: str,
) -> Response[Any]:
    …
  • Internally body.files (a list of File objects with payload: BinaryIO) is passed to json=…, causing serialization errors.

OpenAPI Spec File

paths:
  /upload_files:
    post:
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                hash_:
                  type: string
                files:
                  type: array
                  items:
                    type: string
                    format: binary
      responses:
        '200':
          description: OK

What actually happens

  • The generator emits a single body: UploadFilesPostBody parameter.
  • When calling sync_detailed(..., body=…), httpx is invoked with json=… and fails on BinaryIO because it isn’t valid JSON.

Desktop:

  • OS: Windows 10
  • Python Version: cPython 3.12.8
  • openapi-python-client version 0.24.3

Additional context
None - if anything is needed, please let me know

Dominant language
Python
Stars
2k
Forks
293
Avg merge
34m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openapi-generators/openapi-python-client

All issues in openapi-generators/openapi-python-client

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.