Skip to content

Commit

Permalink
Add validateResponseWithZod parameter to createOperationFetcherFnNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardos77 committed Jan 28, 2024
1 parent 913198c commit 141112b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/typescript/src/core/createOperationFetcherFnNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const createOperationFetcherFnNodes = ({
url,
verb,
name,
validateResponseWithZod,
printNodes,
}: {
dataType: ts.TypeNode;
Expand All @@ -35,6 +36,7 @@ export const createOperationFetcherFnNodes = ({
url: string;
verb: string;
name: string;
validateResponseWithZod: boolean;
printNodes: (nodes: ts.Node[]) => string;
}) => {
const nodes: ts.Node[] = [];
Expand Down Expand Up @@ -122,7 +124,7 @@ export const createOperationFetcherFnNodes = ({
f.createIdentifier("signal")
),
]),
...createZodValidatorResponse(dataType, printNodes),
...(validateResponseWithZod ? createZodValidatorResponse(dataType, printNodes) : []),
],
false
),
Expand Down
1 change: 1 addition & 0 deletions plugins/typescript/src/generators/generateFetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const generateFetchers = async (context: Context, config: Config) => {
url: route,
verb,
name: operationId,
validateResponseWithZod: config.zodFiles !== undefined,
printNodes,
})
);
Expand Down

0 comments on commit 141112b

Please sign in to comment.