Variable types
Inferred from the request schema: z.string() → String!, z.number().int() →
Int!, z.number() → Float!, z.boolean() → Boolean!, z.array(z.string())
→ [String!]!, and .optional() drops the !.
Two cases need naming by hand, because nothing in the Zod type could say otherwise:
ID—z.string()generatesString!, which a server expectingID!rejects. WritevariableTypes: { id: "ID!" }.Input objects — a Zod object cannot name a GraphQL input type. Write
variableTypes: { input: "CreateUserInput!" }.