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

Quotes in Content-Type cause syntax errors

Open
#1,350 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Reproduce the failure with openapi-python-client generate --path api.yml using the OpenAPI example in the issue, then trace where the Content-Type value becomes the generated headers assignment. Done means quoted Content-Type parameters produce legal Python and generation completes without the reported Ruff syntax error.

Written by the indexing model from the issue text.

Description

Describe the bug
Running openapi-python-client generate --path api.yml on the input file below fails with:

Generating /tmp/example-client
Error(s) encountered while generating, client was not created

ruff failed

example_client/api/default/put_object.py:34:62: SyntaxError: Simple statements must be separated by newlines or semicolons
   |
33 |     _kwargs["json"] = _body
34 |     headers["Content-Type"] = "application/ld+json; profile="https://www.w3.org/ns/activitystreams""
   |                                                              ^
35 |
36 |     _kwargs["headers"] = headers
   |
[...]

Quotes in the Content-Type should be escaped so that the generated result is legal Python code.

OpenAPI Spec File

openapi: "3.0.0"

info:
  version: 0.0.1
  title: example

paths:
  /object:
    put:
      requestBody:
        content:
          "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"":
            schema:
              type: string
      responses:
        '200':
          description: OK

Desktop (please complete the following information):

  • OS: Debian 13
  • Python Version: 3.12.11
  • openapi-python-client version: 0.24.3
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.