Skip to content

Commit 2aa1b4b

Browse files
committed
feat(typescript): Improve generated fetcher names
1 parent 8949781 commit 2aa1b4b

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

plugins/typescript/src/generators/generateFetchers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe("generateFetchers", () => {
6969
/**
7070
* Get all the pets
7171
*/
72-
export const fetchListPets = () => petstoreFetch<ListPetsResponse, undefined, {}, {}, {}>({ url: \\"/pets\\", method: \\"get\\" });
72+
export const listPets = () => petstoreFetch<ListPetsResponse, undefined, {}, {}, {}>({ url: \\"/pets\\", method: \\"get\\" });
7373
"
7474
`);
7575
});

plugins/typescript/src/generators/generateFetchers.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,8 @@ export const generateFetchers = async (context: Context, config: Config) => {
108108
withContextType: false,
109109
});
110110

111-
nodes.push(...declarationNodes);
112-
113-
const operationFetcherFnName = `fetch${c.pascal(operationId)}`;
114-
115111
nodes.push(
112+
...declarationNodes,
116113
...createOperationFetcherFnNodes({
117114
dataType,
118115
requestBodyType,
@@ -124,7 +121,7 @@ export const generateFetchers = async (context: Context, config: Config) => {
124121
fetcherFn,
125122
url: route,
126123
verb,
127-
name: operationFetcherFnName,
124+
name: operationId,
128125
})
129126
);
130127
});

0 commit comments

Comments
 (0)