Code-Hex/graphql-codegen-typescript-validation-schema

Support for `lazy`

sschneider-ihre-pvs opened this issue · 3 comments

There is a chance that there will be some self referencing group going on which is currently not supported but is possible in Zod for example

This leads to callstack size exceeded

export function GroupSchema {
  return z.object({
    name: z.string(),
    subGroup:  GroupSchema()
  })
}

This does not

export function GroupSchema {
  return z.object({
    name: z.string(),
    subGroup: z.lazy(() => GroupSchema())
  })
}

@sschneider-ihre-pvs Thanks!
Yeah, I agree fix this if possible to keep returning type the same as current.

Could you send me PR for this?