Skip to content

Commit 49fa298

Browse files
authored
fix: adjust snake case regex (#3785)
* fix: adjust snake case regex * fix: update snapshot
1 parent 0c4e6d2 commit 49fa298

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/rtk-query-codegen-openapi/src/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export async function generateApi(
259259
const allNames = parameters.map((p) => p.name);
260260
const queryArg: QueryArgDefinitions = {};
261261
for (const param of parameters) {
262-
const isPureSnakeCase = /^[a-zA-Z][\\w]*$/.test(param.name);
262+
const isPureSnakeCase = /^[a-zA-Z][\w]*$/.test(param.name);
263263
const camelCaseName = camelCase(param.name);
264264

265265
const name = isPureSnakeCase && !allNames.includes(camelCaseName) ? camelCaseName : param.name;

packages/rtk-query-codegen-openapi/test/__snapshots__/generateEndpoints.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ const injectedRtkApi = api
10051005
overrideExisting: false,
10061006
});
10071007
export { injectedRtkApi as enhancedApi };
1008-
export type GetStructureDefinitionApiResponse = unknown;
1008+
export type GetStructureDefinitionApiResponse = /** status 200 Success */ FhirJsonResource;
10091009
export type GetStructureDefinitionApiArg = {
10101010
/** Some description */
10111011
foo?: any;
@@ -1024,6 +1024,7 @@ export type GetStructureDefinitionApiArg = {
10241024
/** Some description */
10251025
naming_conflict?: any;
10261026
};
1027+
export type FhirJsonResource = object;
10271028
export const { useGetStructureDefinitionQuery } = injectedRtkApi;
10281029

10291030
`;

0 commit comments

Comments
 (0)