acacode / acacode/swagger-typescript-api

Array-type query params are always exploded

Đang mở
#1,541 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug duplicate
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ả

Apologies if I'm missing something obvious, but I'm seeing something unexpected with our generated fetch client.

Our backend API does not support exploded array query params (the Swagger specs specify `explode: false`) but it looks like the HTTP client does nothing to support the unexploded style, it just maps the values and joins them https://github.com/acacode/swagger-typescript-api/blob/main/templates/base/http-clients/fetch-http-client.ejs#L85

I didn't find an obvious config option that would change this behaviour, other than overriding the template or class method, which I was hoping to avoid.

There was an old issue where someone was having the opposite problem, and it looks like the fix applied there actually abandoned any OOTB support the unexploded style https://github.com/acacode/swagger-typescript-api/issues/222

Perhaps this is by design - I'm happy work around it for our project, but since I couldn't find any concrete docs/answers I think it's worth asking, and maybe should be called out that param schemas using `explode` have no support/effect on the generated client.

**Example:**

```openapi
paths:
/some/api/path:
get:
parameters:
- name: test
in: query
style: form
explode: false
schema:
type: array
items:
type: string
enum:
- hello
- world
- yay
```

**Expected request URL:**

`GET /some/api/path?test=hello,yay`

**Actual request URL:**

`GET /some/api/path?test=hello&test=yay`

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.