nascentdigital / contentfully

A simple but performant REST client for Contentful.
MIT License
18 stars 7 forks source link

Add support for validation of entries based on content model #30

Open sdedios opened 4 years ago

sdedios commented 4 years ago

It would be great to be able to enable validation for pre-production scenarios where content might not match the current content model specification.

Content getting out of sync with the latest schema can easily happen as you evolve the content models and incur "content debt" over time.

Having an option to enable validation for the models you pull down, where exceptions or callbacks get call when they are invalid would be really helpful. For example:


const contenfully = new Contentfully(contentfulClient, {
   validate: true,
   onValidationFailed: (entry: any, field: string, reason: string) => throw new Error()
});