openapi-generators / openapi-generators/openapi-python-client
Won't generate client for JSON formatted API with tabs
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 2k
- Forks
- 293
- Merge moyen
- 34 min
- PR mergées (30 j)
- 1
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire la commande signalée avec l’URL JSON OpenAPI liée, puis examinez le chemin de chargement et d’analyse de la source qui traite sa réponse text/plain. Le travail est terminé lorsque le client génère correctement depuis cette URL et que le comportement de fallback est couvert par un test de régression.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- openapi, python
- Domaine
- devtools
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100