Validate entity without persisting it

Just found out, you can use

strapi.entityValidator.validateEntityCreation(strapi.getModel(<uid>), <the entitty>)

And it throws all the validations errors of there are any. There also exists validateEntityUpdate equivalent, which also takes the current entity. Check out strapi/index.js at main · strapi/strapi · GitHub for details.

1 Like