Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unpublish to shouldPublish option of transformEntry function #170

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cachrisman
Copy link
Member

Summary

This PR adds the option to unpublish entries that have been processed by the transformEntry function

Description

In addition to true and false as options for the shouldPublish configuration option, this adds a unpublish option that makes an api call to unpublish the entry being transformed.

Motivation and Context

This is for the situation where the validations of one or more content types are changed such that existing entries would now fail validations and not be publishable without updates. If you are releasing a new version of your frontend and know that only entries which pass the updated content model validation changes will work, this is a way to show your content creators and editors which entries need to be updated to work with the updated frontend.

I did this because of a question in the Contentful Community slack: https://contentful-community.slack.com/archives/CDY4JBMTJ/p1551255690020000

Todos

  • This could potentially be spun out from the shouldPublish option into a validateEntry function that checks entries to see if they would pass validation and unpublishes only the ones that fail the revalidation.
  • Might also want to add this similar functionality to the deriveLinkedEntries and transformEntriesToType functions

@Gi11i4m
Copy link

Gi11i4m commented Mar 5, 2019

I'd definitely focus on the validateEntry function. Not sure if this wouldn't collide with the shouldPublish option. It would be very convenient to be able to automatically unpublish entries that are no longer valid after transformation.
Otherwise an application assuming that the content from contentful adheres to the content-model could fail after a migration, since invalid published entries are possible this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants