unreal - Hello, i have this schema tsconst som...
Hello, i have this schema ```ts
const someSchema = z.object({
description: z
.string()
.min(20, 'Min description length is 20')...
Luan Mário - Guys, I need help, I'm using discr...
Guys, I need help, I'm using discriminatedUnion to join the schemas, but I'm not able to pass more than one defaultValues when starting, it's only accepting one
fahad19 - Hi folks 👋 I am using Zod for lint...
Hi folks 👋
I am using Zod for linting functionality in an open source project of mine: https://featurevisor.com/docs/linting/
one of the use cases I have hit is being able to access the parent/root object when inside .superRefine() of a nested object. I tried reading the docs, and couldn't figure out if it is possible....
Solution:
I tackled the problem by doing superRefine() at root: https://github.com/featurevisor/featurevisor/pull/320
EagleV - hi, how can I test zod z.date() using ...
hi, how can I test zod z.date() using postman? I've tried to pass a ISO date like
2024-08-01T12:00:00Z
but it's not workingSolution:
you can use
z.coerce.date()
zod will parse your input to Date
https://zod.dev/?id=coercion-for-primitives...angrybacon - Hello 👋 apologies in advance if I...
Hello 👋 apologies in advance if I missed it in the issues or documentation
Are named tuple members a thing in Zod?
...
type Range = [left: number, right: number];
type Range = [left: number, right: number];
Solution:
https://zod.dev/?id=tuples
I'm guessing to add names, you might need to pass a generic type to
z.tuple
. Alternatively you could use a refine, something like this (haven't checked the syntax, so could be slightly off):
```ts...ménard - I'm thinking of something like:typesc...
Hi, is there a way without going out of band to make one field always have the same value as another even when it's not part of the input object?
I'm thinking of something like:
```typescript
const vpm = z.object({...
Haddok - Hi everyone , i have to use zod in my ...
Hi everyone , i have to use zod in my javascript environment
i have defined a schema , that has multiple fields
the entire schema validation works perfectly ,
but for javascript i am not sure how to use ...
Solution:
Hi there , thank you for your answer
So basically i have a schema like this
```js
...
doug4794 - I have this login schema and want to...
I have this login schema and want to display my own error message.
```ts
export const loginSchema = z.object({
password: z.string().min(8, { message: i18n("errors.password-too-short") }),...
QBit - Form should not accept decimal nos. For...
Form should not accept decimal nos.
For <=0 numbers code is written to not accept them. Now it accepting positive decimal also but I don't want. What to do?
```ts
"use client"
...
Solution:
found the solution
...
ID: z.coerce.number().int().positive().finite()
ID: z.coerce.number().int().positive().finite()
Bence (Arzen) - Hey guys 🙂I have a (might be)...
Hey guys 🙂
I have a (might be) silly question.
I have a schema exported as module:
```ts
// schema.ts...