✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Does anybody know how to validate the document before allowing publication?

3 replies
Last updated: Sep 24, 2020
Hi!I am using a document workflow based on
https://github.com/sanity-io/demo-custom-workflow .In this the publish action defined in publish.js, publishes via the following line:

ops.publish.execute()
But it seems that this publishes without validating the document at hand.

Does anybody know how to validate the document before allowing publication?
Sep 24, 2020, 8:08 AM
there's also a validation hook iirc
Sep 24, 2020, 9:35 AM
Perfect, just what I was looking for - thanks!
Sep 24, 2020, 9:36 AM

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?