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

Won't generate client for JSON formatted API with tabs

未關閉
#924 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
2k
分支
293
平均合併
34 分鐘
30 天內合併 PR
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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,使用連結的 OpenAPI JSON URL 重現回報的命令,並檢查處理其 text/plain 回應的來源載入與剖析路徑。當用戶端能夠從此 URL 成功產生,且回退行為由回歸測試涵蓋時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
openapi, python
領域
devtools
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。