-
Notifications
You must be signed in to change notification settings - Fork 4.6k
JSON Schema: Update block.json apiVersion to 3 #71852
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
Conversation
2e95615 to
32c18ad
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in 8de8923. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17974568163
|
|
Thanks for the PR!
I'm not sure if we should do this or not - block.json is just a JSON file, and consumers may have extended the core support or added their own. {
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "myplugin/myblock",
"title": "My Block",
"supports": {
"color": {
"text": true,
"myPlugin": {
"myPluginColorControl": true
}
},
"myPlugin": {
"myPluginCustomControl": true
}
}In this PR, how about just updating the API version and doing the schema-based check in #71851? There is also a discussion on how to add custom support: #71012 |
|
I removed the other changes and just updated the
Allowing arbitrary extra properties weakens the schema. It would be nice if they were at least required to follow a prefix like |
t-hamano
left a comment
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.
LGTM! Since this PR ended up being just a PR to update the apiVersion, can we update the PR title and description before merging?
Allowing arbitrary extra properties weakens the schema. It would be nice if they were at least required to follow a prefix like
customMyProperty. Then we could allow them without weakening the schema by allowing arbitrary keys which is why issues like #71800 happen.
This is understandable, and we may be able to consider in a follow-up what keys should be allowed or not.
What?
Disallow extra properties in the supports.colors block.json schema.
Fix existing schema errors (tests had some
apiVersion: 2, only 3 is allowed now).See #71800.
Why?
This fixes and helps prevent schema issues.
This is merged to #71851 where JSON schema checking is added to CI.
Testing Instructions
See tests pass on #71851, specifically JSON schema checks: https://github.com/WordPress/gutenberg/actions/runs/17954394785/job/51061796157