acacode / acacode/swagger-typescript-api

Add an option to disable converting path params into camelCase

Đang mở
#592 3 bình luận 3 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ả

If I have a snake_case path param in original schema like

```yaml
/some/{path_param}/:
...
parameters:
- name: path_param
in: path
required: true
type: string
```

then it'll be converted into camelCase in generated route (using `generateRouteTypes: true`):

```ts
'/some/{path_param}/': {
get: {
params: {
pathParam: number;
};
...
};
}
```

I guess I found this place and I see that this behavior is hard-coded:
https://github.com/acacode/swagger-typescript-api/blob/2b6db2346028fe6fb1f311bf5b1221a89837032e/src/schema-routes/schema-routes.js#L252

The problem is that in our project we don't want path params to be converted into camelCase. We expecting that they are stay as given by schema.

Would be nice to have an option for `generateApi` for disabling this converting. Something like

```ts
return generateApi({
generateRouteTypes: true,
pathParamsInCamelCase: false, // true by default for example
});
```

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.