openapi-generators / openapi-generators/openapi-python-client

Empty response schema generates an exception "Unknown media type schema type"

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

Nobody has claimed this yet.

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

Description

Describe the bug

"responses": {
  "400": {
    "description": "There was a problem with the data sent with the request.",
    "content": {
      "application/json": {},
      "application/xml": {}
    }
  }
}

Not having a schema on the returned content will generate an "Unknown media type schema type" exception. This is valid schema and many code first schema generators create this type of output.

Desktop (please complete the following information):

  • OS: macOS 10.13.7
  • Python Version: 3.10.15
  • openapi-python-client version 0.5.0

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 reproducing the issue with the OpenAPI response example containing empty application/json and application/xml content objects. Trace the media-type schema handling that raises "Unknown media type schema type"; done means valid responses without schemas generate successfully without that exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
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.