Ask questionsSimilar to Yup’s meta properties?

This is an extremely useful feature yup had that is keeping me from transitioning to zod, basically each schema object have additional properties that can be used for validation and other use case.


Answer questions chrbala

Seems like there are quite of lot of arbitrary places where UI could be driven from metadata in some way:

  • max length on a field gets set on the input
  • max length on an array disables or hides an "add row" button

More complex metadata could be something like data driven UI allowing for selection of various complex forms based on a union type.

At some level it seems like there could be a question of whether zod:

  • allows arbitrary fields like this suggestion
  • generates user-accessible metadata based on the built-ins like z.string().max(5)
  • some combination of the above

Related questions

No questions were found.
Github User Rank List