openapi-generators / openapi-generators/openapi-python-client
Won't generate client for JSON formatted API with tabs
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 2k
- フォーク
- 293
- 平均マージ
- 34分
- マージ済み PR(30日)
- 1
説明
Describe the bug
Running
openapi-python-client generate --url https://raw.githubusercontent.com/wikimedia/mediawiki-extensions-Wikibase/e45d4f725e25a95ec2b034238fd3736f19053a16/repo/rest-api/specs/openapi.json
gives me the error
Error(s) encountered while generating, client was not created
Invalid YAML from provided source: while scanning for the next token
found character '\t' that cannot start any token
in "<byte string>", line 2, column 1:
"openapi": "3.1.0",
^
This is a follow-on to this old bug https://github.com/openapi-generators/openapi-python-client/issues/488 which got fixed in https://github.com/openapi-generators/openapi-python-client/commit/b01db03349eb83e4c3ffdd1cc70f7eb2a9c6dae8 . It appears the fix doesn't quite work because github doesn't serve JSON files with the expected content-type (curl with -v gives me "< content-type: text/plain; charset=utf-8").
OpenAPI Spec File
I was trying to generate a client for this code
Desktop (please complete the following information):
- OS: Ubuntu 20.04.6 LTS running under Windows 11
- Python Version: 3.8.0
- openapi-python-client version 0.17.0
Additional context
I think the correct fix ought to be to fall back to JSON parsing in the event of YAML parsing failure (or else a flag to specify?). I'm not sure why the mimetype isn't being guessed right
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リンクされた OpenAPI JSON URL を使って報告されたコマンドを再現し、その text/plain レスポンスを処理するソースの読み込みおよびパース経路を調査します。この URL からクライアントが正常に生成され、フォールバック動作がリグレッションテストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- openapi, python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100