acacode / acacode/swagger-typescript-api

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

Đang mở
#527 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
4.1k
Fork
436
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.