Saskia Bobinska
Senior Support Engineer @Sanity
Validation of url input to allow certain URI schemes (mailto, tel and more included)
{
name: 'url',
title: 'Url',
type: 'url',
description: `Can be a path starting with a '/' or a full Url starting with 'http://' or 'https://'`,
validation: (Rule) =>
Rule.uri({
allowRelative: true,
scheme: ['http', 'https', 'mailto', 'tel'],
}),
},
Sometimes we want to make sure, users can add links for tel:
and mailto:
too.
To make sure these URI
schemes are allowed and won't result in warnings and errors, you can add this validation to your url
schema field and make sure, the urls are right, no matter what they open!
Senior Support Engineer @Sanity
If you install plugins or other packages with conflicting (peer) dependencies, you can use this useful workaround to unblock yourself.
Go to What to do when Studio crashes due to conflicts in dependency versions?When creating custom document actions, it can be necessary to check, wether all validation rules are full-filled.
Go to Use the validation status of a document in your custom document actionsOnly return a value when a condition is fulfilled
Go to Conditional values in GROQ queriesIf you want to make it possible to use parameterised initialValue templates in reference fields, this is how!
Go to Create a new reference document with parameterised initial Values