Colin McDonnell

Results 258 comments of Colin McDonnell

Here's some things I don't like: - `ZodMetadata` existing as a no-op class just to hold data - People getting confused and mad because they can't do stuff like`z.number().metadata({}).min(1)` -...

Thanks for the thoughtful response. > I’m not quite sure why the chaining API is needed and why it can’t look like similar to ZodObject where we just define the...

On further reflection, perhaps there should probably just be new subclasses for `ZodJsonSchema` and `ZodJsonSchemaProperty`. These can implemented in Zod core, or a new package (`zod-json-schema`), or some kind of...

I'm going to close this. Some combination of a new `ZodJsonSchema` class and [plugins](https://github.com/colinhacks/zod/pull/3445) will be the recommended way to handle metadata in Zod 4. A proper RFCs for this...

You can use the `.rest` method on `ZodTuple` to add variadic arguments to a function schema. ```ts z.function() .args(z.tuple([z.string()]).rest(z.number())) .returns(z.number()) .implement((args) => { return args[1]; // [string, ...number[]] }); ```

`ZodEnum` now has a `.exclude()` method that implements this behavior as of Zod 3.21. Top level `z.omit` is probably not going to happen so I'm going to close.

Thank you! Fantastic PR, apologies for the delay on such a no-brainer PR. That accidental range issue could have been a lot worse lol.

This has landed in Zod 3.23. https://github.com/colinhacks/zod/releases/tag/v3.23.0

Not currently, since it's still in flux, but I'll be working to communicate this more completely soon.