You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constPlayerSchema=z.object({color: z.enum(...);});constTeamSchema=z.object({players: z.array(PlayerSchema)});constGameSchema=z.object({// other fieldsteam: z.array(TeamSchema);});
I'd like to add a min size to the array of at least 2, but there's a wrinkle. The form data is flat list of one team. I'd like to use the color to group them into teams and only then validate GameSchema. Then i can add min size 2 to teams.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have schemas like this:
I'd like to add a min size to the array of at least 2, but there's a wrinkle. The form data is flat list of one team. I'd like to use the
color
to group them into teams and only then validate GameSchema. Then i can add min size 2 to teams.Or am i going about this wrong?
Beta Was this translation helpful? Give feedback.
All reactions