Issue with Formatting Restrictions and Content Validation Flags Not Reflecting in Content Management API

Hello DatoCMS Community,

We’ve recently implemented formatting restrictions on certain fields in our project through a migration. The goal was to ensure that our content adheres to specific standards and guidelines. However, we’ve encountered an issue where some of our existing content, which doesn’t comply with the new restrictions, still has the following flags set to true when queried via the Content Management API:

  • is_valid
  • is_current_version_valid
  • is_published_version_valid

To identify the fields and records that violate the new restrictions, we attempted to use the Content Management API to fetch all records and check for any instances where either is_valid, is_current_version_valid, or is_published_version_valid might be set to false. Despite the violations, these variables consistently return true.

This has led us to question whether we are experiencing a bug in the Content Management API, or if there might be an aspect of the API’s validation mechanism we’re misunderstanding. Specifically, we’re concerned that the API’s validation flags are not accurately reflecting the state of our content post-migration.

Could anyone offer insight into why this discrepancy might be occurring? Is there a known issue with the API’s validation flags in relation to newly imposed formatting restrictions, or is there an alternative approach we should consider for accurately identifying non-compliant content?

Any guidance or suggestions would be greatly appreciated as we aim to resolve this issue promptly and ensure our content meets the required standards.

Thank you for your help!

Hi @r.vandenheuvel, and welcome to the forum!

This is something I’d like to investigate further for you, but I need to look at the specific model/records in question. Could you please DM me (or email a link to the records in question? Or you can post it here if you don’t mind sharing it with the public.

Also, does this only happen with the Content Management API, or also the GraphQL API (if you’ve tried it)?

In an example project, I just tried it on some records that were previously valid, then had new validations added onto them making them all invalid. Both APIs immediately returned invalid:

I’ll take a deeper look at your particular circumstances once I get the link. Thanks and sorry about that!