Skip to content

Commit 141112b

Browse files
committed
Add validateResponseWithZod parameter to createOperationFetcherFnNodes
1 parent 913198c commit 141112b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

plugins/typescript/src/core/createOperationFetcherFnNodes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const createOperationFetcherFnNodes = ({
2121
url,
2222
verb,
2323
name,
24+
validateResponseWithZod,
2425
printNodes,
2526
}: {
2627
dataType: ts.TypeNode;
@@ -35,6 +36,7 @@ export const createOperationFetcherFnNodes = ({
3536
url: string;
3637
verb: string;
3738
name: string;
39+
validateResponseWithZod: boolean;
3840
printNodes: (nodes: ts.Node[]) => string;
3941
}) => {
4042
const nodes: ts.Node[] = [];
@@ -122,7 +124,7 @@ export const createOperationFetcherFnNodes = ({
122124
f.createIdentifier("signal")
123125
),
124126
]),
125-
...createZodValidatorResponse(dataType, printNodes),
127+
...(validateResponseWithZod ? createZodValidatorResponse(dataType, printNodes) : []),
126128
],
127129
false
128130
),

plugins/typescript/src/generators/generateFetchers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export const generateFetchers = async (context: Context, config: Config) => {
179179
url: route,
180180
verb,
181181
name: operationId,
182+
validateResponseWithZod: config.zodFiles !== undefined,
182183
printNodes,
183184
})
184185
);

0 commit comments

Comments
 (0)