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
Whenever I need to validate that a queried string is of an allowed set of values, I currently use a combination of q.union and q.literal, e.g. q.union([q.literal('exact'), q.literal('approximate')]).
The query itself is (as expected) not affected by this, so it's just about narrowing the queried type.
Would it be complicated to add native support for ZOD enums similarly to literal, or am I missing a way to chain q calls with z validators to narrow down the queried type?
Thank you!
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Code of Conduct
Feature Request
Whenever I need to validate that a queried string is of an allowed set of values, I currently use a combination of
q.union
andq.literal
, e.g.q.union([q.literal('exact'), q.literal('approximate')])
.The query itself is (as expected) not affected by this, so it's just about narrowing the queried type.
Would it be complicated to add native support for ZOD enums similarly to
literal
, or am I missing a way to chainq
calls withz
validators to narrow down the queried type?Thank you!
The text was updated successfully, but these errors were encountered: