Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Is it Possible to Make a Schema Field Required?

5 replies
Last updated: May 12, 2020
Is it possible to make a schema field required? I have added
required: true
to a few fields but an API mutation seems to still pass through even when no values.
May 12, 2020, 11:34 AM
Normally, you would set validation according to the information in the document Jørn shared above. However, it’s noteworthy that validation is only done client-side within the Studio at this point. That means any API mutations are not validated according to the same rule and you would have to take care of validation yourself here. In the future it might be extended to work server-side as well.
May 12, 2020, 12:15 PM
Good point, Peter
May 12, 2020, 12:15 PM
OK thanks for the info!
May 12, 2020, 12:26 PM
That's a shame that would be a great addition! I'm not sure what percentage of your users work mainly in the studio and who are using mainly as an api?
May 12, 2020, 12:28 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?