Skip to content

Add type-level descriptions to generated Zod schemas #1429

@Code-Hex

Description

@Code-Hex

Follow-up from #1416 and #1423.

withDescriptions now emits .describe() for Zod and Zod v4 fields. #1416 also added .describe() to the generated object schema when the GraphQL type itself has a description, for example an input object description.

That type-level part did not land in #1423. It is still useful, especially when callers pass the root schema to tools that read Zod metadata.

Scope I would keep small:

  • zod and zodv4 only
  • input object schemas, and object/interface schemas when withObjectType is enabled
  • both function and const export modes
  • escaping coverage for quotes, backslashes, and newlines

The field-level behavior is already done, so this should stay focused on type-level .describe() calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions