Skip to content

Zod Generator Produces Large Monolithic Schemas #2535

@bamanyisa

Description

@bamanyisa

I've observed that when using the Zod generator with an OpenAPI specification that utilises the $ref keyword to link between component schemas (e.g., a User schema referencing an Address schema under #/components/schemas), Orval recursively resolves these references.

The final Zod response schema for an operation (e.g., getUserByIdResponse) is generated as a single, large Zod object that contains the entire, inline definition of every referenced component schema, rather than simply referencing their names.

This generates massive files that are difficult to work with, especially in complex specs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededzodZod related issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions