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

Add .describe() for annotating types with descriptions #677

Closed
jasonkuhrt opened this issue Sep 30, 2021 · 2 comments
Closed

Add .describe() for annotating types with descriptions #677

jasonkuhrt opened this issue Sep 30, 2021 · 2 comments

Comments

@jasonkuhrt
Copy link

Originally came up here https://twitter.com/JasonKuhrt/status/1443331235598700544

Idea is that it would be great to be able to add descriptions to schema types so that it can be passed off to other destinations.

Example:

const foo = z.object({
  bar: z.string().description(`about bar`)
}).description(`about foo`)
@colinhacks
Copy link
Owner

Added in zod@3.11.4! 👍

Slight change to proposed API:

const schema = z.string().describe("A description.");
schema.description; // =>  "A description."

@yeongjet
Copy link

yeongjet commented Nov 3, 2022

Already documented ? I can't find any information about .describe() in offical doc . @colinhacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants