sanity
sanity copied to clipboard
URLs URI validation breaks if its not the only validation rule
This works
{
type: "url",
name: "url",
validation: (Rule) => [
Rule.uri({ scheme: ["http", "https", "mailto", "tel"] }),
],
}
This does not work
{
type: "url",
name: "url",
validation: (Rule) => [
Rule.uri({ scheme: ["http", "https", "mailto", "tel"] }),
Rule.custom(() => true),
],
}
It results in this:
Interestingly, this
{
type: "url",
name: "url",
validation: (Rule) => [
Rule.uri({ scheme: ["http", "https", "mailto", "tel"] }),
Rule.custom(() => true).warning(),
],
}
Results in this:
Which versions of Sanity are you using?
@sanity/base 2.30.0 (up to date)
@sanity/cli 2.30.0 (up to date)
@sanity/core 2.30.0 (up to date)
@sanity/default-layout 2.30.0 (up to date)
@sanity/default-login 2.30.0 (up to date)
@sanity/desk-tool 2.30.0 (up to date)
@sanity/vision 2.30.0 (up to date)
Run sanity versions
in the terminal and copy-paste the result here.
What operating system are you using? MacOS Monterey 12.1
Which versions of Node.js / npm are you running?
npm -v && node -v
6.14.16
v14.18.3