Form field / query parameter that either exists and is valid or does not exist, but not exists and invalid #2825
Replies: 1 comment
-
After looking at the implementation of It's also important to point out that they implement We would also likely need to keep track of how many fields we were passed, so that we can ensure every field inside the |
Beta Was this translation helpful? Give feedback.
-
I am trying to find a type or technique that would allow me to have a form field or query parameter that either exists AND is valid, or does not exist at all. Currently, wrapping a field/param in
Option
swallows all errors and makes it impossible to distinguish between actually missing and being invalid.Is there a Rocket type that satisfies this behavior? I managed to create something with this behavior but I don't know if it handles all cases correctly:
My assumption is that there's some combination of
Option
,Strict
, andLenient
that could achieve this behavior, but I don't know. Thank youBeta Was this translation helpful? Give feedback.
All reactions