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

Handle "empty" default values as null

Abierto
#1,376 1 comentario 0 reacciones 0 asignados Ver en GitHub

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
"empty" default values for optional fields throw an error. swagger-parser explicitly allows these (even though they are technically out-of-spec) by converting them silently to null. So, there exist openapi json in the wild built by swagger tools that pass swagger validation, but throw an error here in openapi-python-client.

OpenAPI Spec File
https://www.marinespecies.org/rest/api-docs/openapi.yaml

grep for:

                schema:
                    type: integer
                    default: ""

There are three endpoints that have this property. One of which is AphiaTaxonRanksByID. It might be useful to check this endpoint out in the swagger docs here.

Desktop (please complete the following information):

  • openapi-python-client version 0.28.0

Additional context
I am in contact with the folks at WORMS to try and find out how their openapi.yaml got this way. Will update here when I get more info.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el fallo con el archivo OpenAPI de especies marinas enlazado en la issue, especialmente los esquemas que contienen type: integer y default: "". Rastrea cómo se gestionan los valores predeterminados de los campos opcionales durante la generación del cliente y compara el comportamiento con el tratamiento indicado de swagger-parser. Se considera terminado cuando los endpoints afectados se generan correctamente y los valores predeterminados vacíos se tratan como null.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
openapi, python
Área
backend-api-design, devtools
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.