Skip to content

Declare the field properties the runtime reads in the block schema - #191

Merged
dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:fix/schema-field-properties
Oct 28, 2026
Merged

dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:fix/schema-field-properties

Conversation

@Contributolo

@Contributolo Contributolo commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Groundwork for #190. Before blockstudio/phpstan can report unknown field properties, the schema has to list every property Blockstudio reads. It did not:

Type Property Read in
radio display (buttonGroup) src/blocks/components/fields/components/radio.tsx
radio allowNull radio.tsx, clicking the selected input clears the value
checkbox toggle checkbox.tsx, "select all" checkbox, a string is its label
code asset Block (assetsAsset), documented in Code field assets
wysiwyg mode (code, both) wysiwyg.tsx
repeater default documented in Repeater Initial Rows
color, gradient default, fallback Select_Field_Handler::apply_option_defaults()

For color and gradient, default and fallback were nested inside the options property (as if they were keywords of it), so the field-level keys were missing. They now sit on the field and describe what the handler expects: the value of one of the options.

Changes:

  • schemas/block.json and schemas/extend.json, in all three places that define the field branches, plus manifest.json checksums.
  • src/types/block.ts by hand, like translate in Add a translate field option to leave fields out of the WPML configuration #180 (npm run types would rewrite the whole file).
  • docs/docs/blocks/attributes/field-types.md regenerated with npm run docs:generate.
  • New scripts/tests/schemas.test.ts (runs in test:tooling): every field in tests/theme may only use properties the schema declares for its type. Against the previous schema it lists 59 uses of the properties above; it also found the help test block using set and subSet instead of sets and subSets, fixed here. The help spec only counts help icons, so it is unaffected.

Checks run locally: lint, format:check, typecheck, audit:tooling, docs:check, schemas:check, test:tooling (40 passed). No PHP changes.

The block and extension schemas did not list radio display and allowNull,
checkbox toggle, code asset, wysiwyg mode, and repeater default, although
the editor and the renderer read them and the docs describe asset and
repeater defaults. The default and fallback of color and gradient sat
inside their options property instead of on the field.

A tooling test checks every field in the test theme against the schema
for its type. It also caught the help test block, which used set and
subSet instead of sets and subSets.
@dnnsjsk

dnnsjsk commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Merged and released in Blockstudio 7.7.10. The supported field options are aligned across the schemas, TypeScript definitions, and generated documentation, with regression coverage. Full CI and distribution checks passed.

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.

2 participants