Skip to content

Conversation

@MPiland
Copy link

@MPiland MPiland commented Jun 5, 2025

I needed a way to build only the input schemas, add discriminators, and only do lazy where it's truly needed on circular references so I added these options.

  • inputOnly is a boolean that when true will only output input schemas.
  • inputDiscriminator accepts any string and that sets the property to be only that. For all except Yup, it uses .literal(string). Yup uses .string().oneOf([string]).defined()
  • lazyStrategy is typed as 'all' | 'circular' and defaults to all if nothing is set. If 'circular', it will only add the lazy function on truly circular references.

I also added 'zodv4' as a schema option and there is a folder dedicated to zodv4. This includes changing nativeEnum to enum, changing Properties to be z.ZodType<T[K], T[K]>, and setting any to actually be z.any(). Zod v4 updated the z.unknown() and z.any() to no longer be marked as "key optional" in the inferred types.

The other configs should still work as is from what I tested.

@MPiland MPiland closed this Jun 5, 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

Successfully merging this pull request may close these issues.

1 participant