acacode / acacode/swagger-typescript-api

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

未关闭
#527 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
4.1k
派生
436
PR 合并指标
30 天内没有已合并 PR

描述

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,
}),
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。