Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add descriptions for zod #1962

Conversation

TheJokersThief
Copy link
Contributor

@TheJokersThief TheJokersThief commented Mar 9, 2025

Status

READY

Fix #1715

Description

Adds parameter descriptions to generated zod definitions, using the zod.describe("<string>") function.

Example output:

export const addListQueryLimitRegExp = new RegExp('^\\+\\d{10, 15}');


export const addListQueryParams = zod.object({
  "limit": zod.string().regex(addListQueryLimitRegExp).optional().describe('How many items to return at one time (max 100)'),
  "birthdate": zod.string().date().optional().describe('birth date')
})

Reference docs: https://zod.dev/?id=describe

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Related Issues

Found this before doing the work:

@TheJokersThief TheJokersThief force-pushed the thejokersthief/add-zod-descriptions branch from 365e3af to 4a75c2f Compare March 9, 2025 14:20
@melloware melloware added the zod Zod related issue label Mar 9, 2025
@melloware melloware merged commit 8835a46 into orval-labs:master Mar 9, 2025
2 checks passed
@TheJokersThief TheJokersThief deleted the thejokersthief/add-zod-descriptions branch March 10, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zod Zod related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add description property to Zod generated schema
2 participants