File tree Expand file tree Collapse file tree
typescript/gql-client/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export function createJSONSerializer<
1919 method : 'POST' ,
2020 body : JSON . stringify ( {
2121 query : operation . document ,
22- variables
22+ variables : operation . variablesSchema . parse ( variables )
2323 } , ( key , value ) => {
2424 assert (
2525 ! ( value instanceof File ) ,
Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ export function createMultipartSerializer<
9595 return {
9696 method : 'POST' ,
9797 headers,
98- body : buildFormData ( operation , variables as any ) ,
98+ body : buildFormData (
99+ operation ,
100+ operation . variablesSchema . parse ( variables ) as any
101+ ) ,
99102 ...requestContext . fetchOptions
100103 }
101104 } ,
Original file line number Diff line number Diff line change 11import { z } from 'zod/v4'
22
3- export type SchemaFor < T > = z . ZodType < T > ;
3+ export type SchemaForInput < T > = z . ZodType < unknown , T > ;
4+ export type SchemaForOutput < T > = z . ZodType < T > ;
45
56interface BaseOperation < V , R > {
67 name : string
78 document : string
8- variablesSchema : SchemaFor < V >
9- resultSchema : SchemaFor < R >
9+ variablesSchema : SchemaForInput < V >
10+ resultSchema : SchemaForOutput < R >
1011 hash : string
1112}
1213
You can’t perform that action at this time.
0 commit comments