Skip to content

Add block.json apiVersion 3+ validation to Plugin_Content_Check with mode-based severity#1206

Merged
ernilambar merged 4 commits intotrunkfrom
1205-check-editor-blocks-must-use-apiversion-3-or-higher-wordpress-70
Mar 10, 2026
Merged

Add block.json apiVersion 3+ validation to Plugin_Content_Check with mode-based severity#1206
ernilambar merged 4 commits intotrunkfrom
1205-check-editor-blocks-must-use-apiversion-3-or-higher-wordpress-70

Conversation

@davidperezgar
Copy link
Copy Markdown
Member

Summary

This PR addresses #1205 by adding a static validation for block apiVersion compatibility with the WordPress 7.0 iframe editor.

Instead of introducing a separate check class, the validation was integrated into the existing Plugin_Content_Check to keep plugin-repo content rules consolidated.

What changed

  • Added block.json scanning in Plugin_Content_Check.
  • Added validation to flag blocks where apiVersion is:
    • missing
    • empty
    • lower than 3
    • invalid/non-numeric JSON value
  • Included all block.json files in plugin scope (including nested paths).

Severity behavior by mode

  • New plugin mode (new):
    • reports error
    • severity 7
  • Update mode (update):
    • reports error
    • severity 5

Tests

Added coverage in Plugin_Content_Check_Tests using dedicated fixtures:

  • failing plugin fixture:
    • missing apiVersion
    • empty apiVersion
    • apiVersion: 1
    • apiVersion: 2
  • passing plugin fixture:
    • apiVersion: 3
    • apiVersion: 4
  • assertions for mode-dependent result type and severity (7 vs 5)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: davidperezgar <davidperez@git.wordpress.org>
Co-authored-by: ernilambar <nilambar@git.wordpress.org>
Co-authored-by: frantorres <frantorres@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ernilambar ernilambar added this to the 1.9.0 milestone Mar 9, 2026
@ernilambar ernilambar merged commit 3af1ef8 into trunk Mar 10, 2026
27 checks passed
@ernilambar ernilambar deleted the 1205-check-editor-blocks-must-use-apiversion-3-or-higher-wordpress-70 branch March 10, 2026 03:51
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.

Check: Editor blocks must use apiVersion 3 or higher (WordPress 7.0)

3 participants