openapi-generators / openapi-generators/openapi-python-client
Won't generate client for JSON formatted API with tabs
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 2k
- Forks
- 293
- Merge medio
- 34 min
- PR fusionados (30 d)
- 1
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el comando reportado con la URL JSON de OpenAPI enlazada e inspecciona la ruta de carga y análisis de la fuente que gestiona su respuesta text/plain. Se considera terminado cuando el cliente genera correctamente a partir de esta URL y el comportamiento de fallback está cubierto por una prueba de regresión.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- openapi, python
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100