You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
exportfunctionAuthorSchema(): z.ZodObject<Properties<Author>>{returnz.object({email: z.string(),name: z.string(),// this field I don't wantpassword: z.string()// this field I don't want})}
Curious if there's any plan to add this feature? Would be super helpful to have schema parsers for queries when the data is cached somewhere and needs to be parsed back.
Activity
charlescrain commentedon Feb 27, 2025
Curious if there's any plan to add this feature? Would be super helpful to have schema parsers for queries when the data is cached somewhere and needs to be parsed back.
Code-Hex commentedon Feb 28, 2025
@charlescrain No I don't have plan for query. I accept PR because there are too many patterns, but most recently I am not going to work on them
Code-Hex commentedon Apr 25, 2026
Fixed in #1423. Zod and Zod v4 now have withOperationType, which generates schemas from operation selection sets instead of the full object type.