-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
RTKQ-CodegenIssues related to the @rtk-query/codegen-openapi package.Issues related to the @rtk-query/codegen-openapi package.
Description
In my API I use a variation of camel casing that preserves uppercase in abbreviations. For example, userId becomes userID. Normally this is interpreted as camel case and I would not expect any transformations to be applied to the string.
The issue is that RTK-Query Codegen uses the lodash camelCase function, which converts userID to userId. Lodash's behavior in this regard has been controversial (see lodash/lodash#5045) and I think it would be better to use an alternative (like hump) which has the expected behavior.
Relevant code:
redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts
Lines 218 to 221 in 2bb44b9
| const isPureSnakeCase = /^[a-zA-Z][a-zA-Z0-9_]*$/.test(param.name); | |
| const camelCaseName = camelCase(param.name); | |
| const name = isPureSnakeCase && !allNames.includes(camelCaseName) ? camelCaseName : param.name; |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
RTKQ-CodegenIssues related to the @rtk-query/codegen-openapi package.Issues related to the @rtk-query/codegen-openapi package.