acacode / acacode/swagger-typescript-api

Request returning null in data and error when no response type defined

Abierto
#536 8 comentarios 9 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
4.1k
Forks
436
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi,
I'm encountering an issue when defining a 2xx response code without response type defined. like:
```
...
responses:
200:
description: A successful response.
# schema:
# $ref: "#/definitions/performResponse"
default:
description: Generic error response.
schema:
$ref: "#/definitions/error"
```
When I generate the code like:
`npx swagger-typescript-api -p ./swagger.yml -o ./mypath -n myfile.ts`

The request is ALWAYS returning null for both "data" and "error". (see image(I added a console.log()))
![Screenshot 2023-05-31 at 2 23 38 PM](https://github.com/acacode/swagger-typescript-api/assets/11819101/346e7eab-8c4e-4b1a-9108-af09bd193cfb)

If I define a response type (by uncomenting the lines there) then there is something in the "data" or "error" but not sure why and if this might be a bug.

![Screenshot 2023-05-31 at 2 34 34 PM](https://github.com/acacode/swagger-typescript-api/assets/11819101/00c03793-b53a-4248-9c84-39e6417abc18)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.