Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Quotes in Content-Type cause syntax errors #1350

Open
@FenTiger

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /