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

Expose Gutenberg Data Format version in the REST API #6435

Closed
pento opened this issue Apr 26, 2018 · 3 comments
Closed

Expose Gutenberg Data Format version in the REST API #6435

pento opened this issue Apr 26, 2018 · 3 comments
Labels
Core REST API Task Task for Core REST API efforts [Type] Enhancement A suggestion for improvement.

Comments

@pento
Copy link
Member

pento commented Apr 26, 2018

Issue Overview

More advanced REST API consumers will want to switch how they handle post_content depending on whether the content contains blocks or not, and (in the future) will likely want to switch based on which version of the block format it contains.

Rather than requiring consumers to duplicate how Gutenberg determines whether to parse blocks or not, we can expose the same information in post objects returned by the REST API.

Currently, it would return:

  • 0: The post_content does not contain blocks, it can be treated as classic content.
  • 1: The post_content contains blocks, it should be treated appropriately.

If the block format has back compat breaking changes in the future, we can increment this value as needed.

For an immediate practical use, this would be useful for the WordPress mobile apps to decide how to handle the post_content: wordpress-mobile/WordPress-iOS#9194

The bug that caused this change needing to be made in the mobile apps is also why we should be exposing a flag, instead of relying on Gutenberg's internal behaviour: when we changed how core blocks are stored in #2950.

@pento pento added [Type] Enhancement A suggestion for improvement. Core REST API Task Task for Core REST API efforts labels Apr 26, 2018
@pento pento added this to the Merge Proposal: REST API milestone Apr 26, 2018
@pento
Copy link
Member Author

pento commented Apr 26, 2018

A side note on implementation details: I would expect the version to stay at 1 until the WordPress 5.0 release: there may still be breaking changes in the format between now and then, but until that point, I would like for Gutenberg to not be bogged down in back compat handling.

@aduth
Copy link
Member

aduth commented Apr 26, 2018

Related: #2649

@danielbachhuber
Copy link
Member

🔨

I've gone ahead and created a Trac ticket for this: https://core.trac.wordpress.org/ticket/43887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core REST API Task Task for Core REST API efforts [Type] Enhancement A suggestion for improvement.
Projects
No open projects
Development

No branches or pull requests

3 participants