ternary validation #994
Unanswered
BerkliumBirb
asked this question in
Q&A
Replies: 1 comment 4 replies
-
This is a typical OR condition that can be covered by import * as v from 'valibot';
import { isAbsolutePath } from '~/utils';
const Schema = v.union([
v.pipe(v.string(), v.startsWith('ftp://'), v.url()),
v.pipe(v.string(), v.check(isAbsolutePath)),
]); |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. I have a task that looks like this:
I tried to implement that using
union
:But the problem is that
union
fallbacks to the next part if one fails, thus any Userinfo checks are always silenced.Would be great to have something like this:
or
Is there any way to implement this thing?
Beta Was this translation helpful? Give feedback.
All reactions