acacode / acacode/swagger-typescript-api

No result from methods that do not have an explicit content type

Aberta
#527 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
4.1k
Forks
436
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

When generating an api from a spec that does not define the content, the generated code does not return anything.

IMO, since a result type is defined it should return a result.

e.g. from https://github.com/gothinkster/realworld/blob/main/api/openapi.yml

```
responses:
'200':
$ref: '#/components/responses/MultipleArticlesResponse'
```

will generate

```
this.request({
path: `/articles`,
method: "GET",
query: query,
...params,
}),
```

The problem is that this method will not return anything.

If I manually change the spec:

```
'200':
content:
application/json:
$ref: '#/components/responses/MultipleArticlesResponse'
```

I get the correct result with:

```
this.request({
path: `/articles`,
method: "GET",
query: query,
format: "json",
...params,
}),
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.