Open alexandereneroth opened 2 years ago
Does it happen if you chain both rules?
{
type: "url",
name: "url",
validation: (Rule) => Rule
.uri({ scheme: ["http", "https", "mailto", "tel"] }),
.custom(() => true)
],
}
Thanks! that did work. Seems like the problem appears when you return an array from the validation function
Hi @RitaDias, do you know why this issue was closed?
What KittyGiraudel suggested worked for alexandereneroth, but the original bug is still present in the most recent versions: uri validations don't work correctly when in an array of validations, which as far as I know are the only way of mixing warnings with errors, which in turn means I can't have a uri validation give an error in a field where I also want another validation to give a warning.
I just had this happen to me and had to give up on the warning validation in order to have the uri validation.
Versions @sanity/cli (global) 3.24.1 (latest: 3.38.0) @sanity/cli 3.24.1 (latest: 3.38.0) @sanity/dashboard 3.1.6 (up to date) @sanity/ui 1.9.3 (latest: 2.1.4) @sanity/vision 3.24.1 (latest: 3.38.0) sanity 3.24.1 (latest: 3.38.0)
Hi @fvieira!
I don't quite recall what was done at the time since it's been a while, however I've added this to our triaging to be prioritised :)
Thanks for reporting it!
This works
This does not work
It results in this:
Interestingly, this
Results in this:
Which versions of Sanity are you using?
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?