Saskia Bobinska
Support Engineer @Sanity
Saskia is located at Berlin Germany
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!
Support Engineer @Sanity
How to validate nested fields from the document or object level
Go to Validation of children in objectsSometimes you want to validate items in an array, here is how
Go to Validation of Array ItemsAn Email field, that uses Regex-Validation.
Go to Email Field with Validation