Open
Description
I need the schemas not just for graphql inputs but also for graphql queries to be able to validate preloaded data from the database for a page. I can't just use withObjectType
because it potentially contains more fields than the graphql query.
Example
GraphQL type:
type Author {
email: String!
name: String!
password: String!
}
My GraphQL query operation:
query Author {
author {
email
}
}
The zod schema I get:
export function AuthorSchema(): z.ZodObject<Properties<Author>> {
return z.object({
email: z.string(),
name: z.string(), // this field I don't want
password: z.string() // this field I don't want
})
}
Instead I need a schema like this:
export function AuthorQuerySchema(): z.ZodObject<Properties<AuthorQuery>> {
return z.object({
email: z.string()
})
}
Metadata
Metadata
Assignees
Labels
No labels