openapi-generators / openapi-generators/openapi-python-client
Won't generate client for JSON formatted API with tabs
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 2k
- Forks
- 293
- Ø Merge
- 34 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den gemeldeten Befehl mit der verknüpften OpenAPI-JSON-URL zu reproduzieren, und untersuche den Pfad zum Laden und Parsen der Quelle, der die text/plain-Antwort verarbeitet. Als erledigt gilt die Aufgabe, wenn der Client erfolgreich aus dieser URL generiert und das Fallback-Verhalten durch einen Regressionstest abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- openapi, python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100