-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
In your docs you have the following example:
const schema = z
.object({
// Provide graphql-specific metadata to your zod schema
foo: graphqlFieldOptions(z.string(), {
parameters: {
bar: variablePlaceholder('$bar')
}
})
})
.strict();
// Send the query using the client
const client = createGraphqlClient({ endpoint: 'https://example.com/graphql' });
const result = await client.query(schema, {
operationName: 'YourQueryName', // Optional query name
variables: {
bar: {
type: 'String!',
value: 'the-actual-value-for-bar'
}
}
});
What puzzles me is that the type of the variable is only 'defined' when running the query.
How would I be able to have the String!
here be part of the schema, instead of the OperationOptions
?
And would it subsequently be possible to have (limited) type-safe variables as well (e.g., make it impossible to pass value: 22
for bar
in this example)?
If none of this is in-scope for these libraries, please feel free to close this issue.
Metadata
Metadata
Assignees
Labels
No labels