swagger-api / swagger-api/swagger-codegen

[python] Support binary data in body

Open
#10,861 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

API expects data send as application/octet-stream in the body of the request.

Swagger-codegen version

latest, it has never been working.

Swagger declaration file content or url

There are body sanitization checks that do not allow application/octet-stream

Command line used for generation

java -jar swagger-codegen-latest.jar generate -i <path to openapi spec> -l python

Steps to reproduce
  1. Generate api_client.py and rest.py as part of generate command.
  2. Try to use API that accepts Content-Type: application/octet-stream and send data in body
Related issues/PRs

There is similar problem reported on JAVA language as well https://github.com/swagger-api/swagger-codegen/issues/669

Suggest a fix/enhancement

At the moment we don't have any working patch.

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.

Research direction

Start by inspecting the body sanitization checks in the generated api_client.py and rest.py files for the Python client. Reproduce the request with Content-Type application/octet-stream and binary body data; done means the generated client can send that body without the sanitization rejecting it.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.