swagger-api / swagger-api/swagger-ui

content type of string/binary property should be octet-stream

Open
#7,820 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Ubuntu
  • Browser: Firefox 96.0.2
  • Method of installation: docker container
  • Swagger-UI version: 4.4.1
  • Swagger/OpenAPI version: [OpenAPI 3.0]
Content & configuration

Example Swagger/OpenAPI definition:

put:
  requestBody:
    content:
      multipart/form-data:
        schema:
          type: object
          properties:
            myProperty:
              type: string
              format: binary
Describe the bug you're encountering

When sending the above request in swagger UI myProperty is getting the header Content-Type: text/plain but according to this
it should be application/octet-stream.

If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream

Expected behavior

The content type for a string/binary property is application/octet-stream.

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 in Swagger UI by reproducing the multipart/form-data request from the issue, using a requestBody property with type string and format binary. Trace how the myProperty part receives its header and verify that the completed behavior uses application/octet-stream instead of text/plain.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.