Skip to content

v4: meta not kept when using z.stringbool() #4138

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

Open
arthurvanl opened this issue Apr 13, 2025 · 0 comments
Open

v4: meta not kept when using z.stringbool() #4138

arthurvanl opened this issue Apr 13, 2025 · 0 comments

Comments

@arthurvanl
Copy link

arthurvanl commented Apr 13, 2025

Minimal reproduction:

export const _userSchema = z.interface({
    daily_1: z.string().meta({description: 'oke', primary: true}),
    d: z.email()
    // daily_report_mail: z.stringbool(({truthy: ['1', 'true'], falsy: ['0', 'false']})).meta({title: 'asdasdasd',description: 'Whether this user should receive daily csv report emails', examples: [false]}),
})
console.dir(z.toJSONSchema(_userSchema), {depth: 4})

Version: ^4.0.0-beta.20250412T085909

Method Meta Kept Info
z.string()
z.email()
z.int()
z.number()
z.boolean()
z.bigint() ⚠️ Couldn't be tested in objects, so I dont feel like using
z.undefined()
z.symbol() ⚠️ Couldn't be tested in objects, so I dont feel like using
z.null()
z.coerce.string()
z.coerce.number()
z.coerce.boolean()
z.literal()
z.templateLiteral()
z.stringbool()
z.optional(z.stringbool()).meta({description: 'oke'})
z.optional(z.stringbool().meta({description: 'oke'}))
@arthurvanl arthurvanl changed the title meta not kept when using z.stringbool() v4: meta not kept when using z.stringbool() Apr 13, 2025
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

1 participant