-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Increment theme.json
version to 3
#40232
Conversation
theme.json
version from 2 to 3theme.json
version to 3
A related task I'll address shortly is to generate the v3 docs for the block editor handbook https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/ |
@oandregal, is it necessary for the WP 6.0 Beta 1 release tomorrow? |
@gziolo this needs to be part of the WordPress 6.0 release. If we could have it in he Beta 1 tomorrow it'll be ideal so we don't have to worry for this anymore. Everything will work fine without these changes, so if we want to punt it for after the beta 1, that'd be fine as well. |
When I add a new reviewer another one is removed? I presume there's some kind of limit to the number of reviewers. The pings in this PR are mostly for awareness for people that worked in this area: when the |
I see there's an unit test failure for |
@adamziel noticed that, too. I guess it's related to the core commit WordPress/wordpress-develop@067d166. I'm investigating whether there are any differences in the implementaion in Gutenberg. |
@gziolo fixed that problem in WordPress/wordpress-develop@cab6fec |
Do we really need to update the version for non-breaking additions? |
I'm looking forward to the final decision. We are going to update |
For block.json for instance, It evolved a lot (new keys...) since the v2 and we never needed to update the version number. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together @oandregal 👍
For block.json for instance, It evolved a lot (new keys...) since the v2 and we never needed to update the version number.
I expect we will have a larger number of 3rd parties leveraging theme.json. Would that increase the need to accurately match schema changes to WP releases that introduce them?
This probably also sets a good standard for maintaining versioning around theme.json as well.
✅ Theme.json migration doc update looks fine.
✅ Unit tests pass
class-wp-theme-json-test.php
class-wp-theme-json-schema-gutenberg-test.php
class-gutenberg-rest-global-styles-controller-test.php
if ( 2 === $theme_json['version'] ) { | ||
$theme_json['version'] = 3; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate this change is trivial but for consistency with the other theme.json classes and 6.0 related changes should we override this class in the same manner? I'm also ok with leaving it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, you're right, should this land, we need to fix it.
The JSON schema is loaded from the |
We don't need this for anything to work and themes don't need to be adapted either. Though, I was under the impression that we wanted a new version for each theme.json schema with changes, so we could say, for example, How would we provide this clarity for theme authors if we don't do this? 🤔 The keys/sections that are not supported in a given runtime are ignored. For example, a theme.json for WordPress 5.8 needs to use I'm struggling to see how to clarify this for theme authors if we don't have versions. An alternative is to deemphasize versions in the block editor theme.json schema docs and follow instead the model of the block API docs: sections per key. For each key, we need to document which runtime (WordPress version) supports it. Is this any better? |
For me the apiVersion is not about additions, it's only about breaking changes. Whenever we introduce a feature that is likely to introduce breaking change, we introduce a new version that way we don't break anything for existing themes unless they opt-in (update version) for their theme.
This is a valid use-case because it's a breaking change, if they don't change the version, the old key won't work. Changing the apiVersion on each addition likely means that themes will have to play catchup with core and update their themes with each new version even if they don't make any changes. The alternative is them not updating the version but the new key still works (If I'm not wrong, even if my version is 2, the new keys will continue to work, so it's incoherent) |
Good point. And this actually diminishes the value of using the version as documentation: Let's try to address the documentation concerns in a different way: de-emphasize version and focus on documenting which setting works in a given runtime. |
What?
This PR increments the
theme.json
version to 3.Why?
We've added some new things to the
theme.json
schema, so we need to publish a new one to document in which WordPress version a specific setting can be found.There's no modifications or removals in the existing schema, only additions:
title
top-level keypatterns
top-level keysettings.color.defaultDuotone
setting keyThe behavior is the same as before, this serves to semantically mark the new files. This version change will be documented in the block editor handbook as well with a PR sent to the Gutenberg repository.
How?
Updates the version in the
theme.json
file bundled with Gutenberg and in the theme.json class.Related PR to core at WordPress/wordpress-develop#2565
Testing Instructions
Does not have any effect at runtime.