sanity icon indicating copy to clipboard operation
sanity copied to clipboard

URLs URI validation breaks if its not the only validation rule

Open alexandereneroth opened this issue 2 years ago • 4 comments

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: Screenshot 2022-05-20 at 12 34 13

Interestingly, this

    {
      type: "url",
      name: "url",
      validation: (Rule) => [
        Rule.uri({ scheme: ["http", "https", "mailto", "tel"] }),
        Rule.custom(() => true).warning(),
      ],
    }

Results in this: Screenshot 2022-05-20 at 12 36 00

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

alexandereneroth avatar May 20 '22 10:05 alexandereneroth