Custom validation

It would be great to provide a snippet of javascript or similar that would evaluate input for a given field and return either an all-good or an error message.

We can implement this in two ways:

  • User provides an endpoint, and DatoCMS calls such endpoint passing the payload to validate
  • User provides some JS validation function, and DatoCMS runs it inside a sandbox environment https://www.npmjs.com/package/vm2