Skip to content

Zod: add default when OpenAPI schema specifies a default value. #2577

@giuliobracci

Description

@giuliobracci

Given a schema with a default specified, I'd expect the generated Zod schema to have a fallback with the property .default({value}). That's not the case at the moment.

The current solution I've found is to have a post generation script do the heavy lifting, but that would be indeed a nice to have. Maybe behind a flag, to not strictly do a breaking change.

Metadata

Metadata

Assignees

Labels

breaking changeBreaking change on upgradezodZod related issue

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions