[X] I agree to follow this project's 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 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!
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 toliteral
, or am I missing a way to chainq
calls withz
validators to narrow down the queried type? Thank you!