fix(block): require string keywords - #36
Merged
Merged
Conversation
Leave other untyped array items unchanged because their serialized element shapes need targeted ACF evidence before narrowing the public schemas.
parisek
force-pushed
the
fix/block-keywords-item-type
branch
from
August 10, 2026 11:24
55eef2c to
bf4e3f9
Compare
parisek
marked this pull request as ready for review
August 10, 2026 11:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From-Project
Found in
sloneekwhile straighteningdefinition-kitgenerator drift.keywordswas one of two block-config keys the generator was dropping (fixed upstream in
definition-kit v0.8.1); reviewing that fix surfaced that this package never
constrained the key's item type in the first place.
Why
"keywords": [1, 2, 3]passed both the validator andacf-lint --strict. WordPressblock metadata requires an array of strings — a numeric entry reaches the block
registry and is not usable as a search keyword. The schema declared
type: ["null", "array"]and stopped there.What
items: { "type": "string" }onkeywords, in the extractor source and thegenerated
schemas/block.schema.json.tests/fixtures/invalid/block-keywords-non-string/) thatasserts the violation at
/keywords/0. It was accepted before this change.186 PHPUnit tests pass (1 expected skip), PHPStan clean, ADR check clean, and the
extractor output byte-matches the committed schema.
Deliberately not done
No
minLength: 1. The package applies that constraint only where empty-stringstripping is already known to occur, which is not the case here. Adding it would be
a new rule, not the gap being closed.
Other untyped-array properties left alone. The same gap exists on
acf.hide_on_screen,cpt.capability_type,cpt.taxonomies, and a number offield-schema arrays (choice arrays, default values, clone targets, palette colours,
icon tabs, post-type/taxonomy/status filters, bidirectional targets, relationship
filters, user roles, conditional-logic groups). Each needs real ACF serialization
evidence to type correctly — several accept mixed scalar shapes — so guessing an
item type would trade a permissive schema for a wrong one. Reported here rather
than fixed; worth its own issue.