Endpoint fields
| Field | Required | Meaning |
|---|---|---|
operation | yes | "query" or "mutation" |
root | — | The single field to unwrap, so response describes data.user rather than data. Also the field the variables attach to as arguments. |
document | — | A hand-written operation. Omit it to have one generated. |
operationName | — | Defaults to the endpoint id in PascalCase (user.get → UserGet). |
variableTypes | — | GraphQL types for variables the Zod type cannot name — { id: "ID!" }. |
errorPolicy | — | "none" (default) or "all". See below. |
Everything transport-independent — auth, permission, errors, mockData,
headers, test — works exactly as it does for an HTTP endpoint.
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!" }.