Contentful logo

Contentful Community

Cannot publish validated entry when referencing itself?

Hello!

To keep the issue simple, we can say that my team has a constructed a content model where we have a type called a Page. This type has two fields: One is a relative path to the page, and one field is a many-reference to other Pages.

We want to use the list of referenced Pages to render them as links in a navigation. We generally want the Page to reference itself as well so it can render itself as a navigation option. This works as expected, except when we want add validation in Contentful to the reference field. When we add the condition to only allow the Page type among the references to be sure the data can be used in the navigation, we added validation in the form of only accepting entries of the Page type. This however breaks the editing: Where before we could publish entries that referenced themselves, now after we added the validation we can no longer publish or create new Pages that reference themselves. This seems like a bug, and my team and I would like assistance to solve this, since we do want the validation so that editors cannot accidentally add types that cannot be rendered in the navigation.

Thanks in advance for any helpful insights!