openapi-generators / openapi-generators/openapi-python-client
Quotes in Content-Type cause syntax errors
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 2k
- フォーク
- 293
- 平均マージ
- 34分
- マージ済み PR(30日)
- 1
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue にある OpenAPI の例を使用して openapi-python-client generate --path api.yml で失敗を再現し、Content-Type の値が生成された headers 代入になる箇所を追跡します。引用符で囲まれた Content-Type パラメーターが有効な Python を生成し、報告された Ruff 構文エラーなしで生成が完了すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100