Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

Custom Validation - Is it Possible?

4 replies
Last updated: Jul 29, 2020

i have an array of different content modules that make up the pages of a website. most of the modules can be repeated freely throughout a page, but there are a few modules that i'd like to limit to 1 per array. assuming this would be done using

validation? has anyone done this?

Jul 29, 2020, 5:57 PM

not very sure about this but I think

__experimental_actions: [/*'create',*/ 'update', /*'delete',*/ 'publish']
can be a solution. This limits the document or object to be updated and published but not created or deleted. I believe it removes the create and delete buttons

Jul 29, 2020, 6:28 PM

this is usually used with siteSettings which is usually used once through out the site

Jul 29, 2020, 6:29 PM

this isn't quite what im looking for

Jul 29, 2020, 6:35 PM

i think i solved the problem thank you!

Jul 29, 2020, 6:35 PM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.