Description
The scf/list-fields ability validates its output against an output_schema that is an array of oneOf over ~39 per-field-type variants (each pinning type to a single-value enum, with additionalProperties: false and internal properties requiring ID >= 1). Because array validation is all-or-nothing, a single non-conforming field invalidates the entire listing, returning ability_invalid_output instead of results.
Two independent triggers:
- Code-registered fields always fail. Fields registered via
acf_add_local_field_group() legitimately have ID => 0, violating the ID minimum: 1 constraint in schemas/internal-properties.schema.json. Any site that registers fields in code — a very common pattern — gets a broken scf/list-fields.
- Unknown field types fail. A field stored with a type that has no schema variant (third-party field type, or a type whose plugin was deactivated) matches no
oneOf branch and poisons the whole response.
Additionally, the comment at includes/class-scf-schema-builder.php:30 claims a "Fallback variant allows unknown types until all 35 field types have schemas" — but the generated schemas/field.schema.json contains no fallback variant. The stale comment points at the missing piece.
Affected code
includes/abilities/class-scf-field-abilities.php:277-281 (list output schema)
schemas/internal-properties.schema.json (ID definition, minimum: 1)
includes/class-scf-schema-builder.php:30 (stale fallback comment)
Reproduction
Covered by repro tests in #450: tests/php/includes/abilities/test-scf-list-fields-schema-robustness.php
test_local_text_field_fails_output_schema_due_to_id_zero
test_single_drifted_field_invalidates_entire_list_output
Also observed live as an order-dependent E2E failure before suite isolation was added (a stray malformed field bricked the listing for the whole run).
Suggested fix directions
- Add the permissive fallback
oneOf variant the schema-builder comment promises, and/or
- Relax
ID to minimum: 0 (or document local fields' ID semantics), and/or
- Sanitize/skip invalid items in
list_callback so one bad field degrades to omission instead of total failure.
Found during the 2026-06 test campaign (see PR #450).
Description
The
scf/list-fieldsability validates its output against anoutput_schemathat is an array ofoneOfover ~39 per-field-type variants (each pinningtypeto a single-value enum, withadditionalProperties: falseand internal properties requiringID >= 1). Because array validation is all-or-nothing, a single non-conforming field invalidates the entire listing, returningability_invalid_outputinstead of results.Two independent triggers:
acf_add_local_field_group()legitimately haveID => 0, violating theIDminimum: 1constraint inschemas/internal-properties.schema.json. Any site that registers fields in code — a very common pattern — gets a brokenscf/list-fields.oneOfbranch and poisons the whole response.Additionally, the comment at
includes/class-scf-schema-builder.php:30claims a "Fallback variant allows unknown types until all 35 field types have schemas" — but the generatedschemas/field.schema.jsoncontains no fallback variant. The stale comment points at the missing piece.Affected code
includes/abilities/class-scf-field-abilities.php:277-281(list output schema)schemas/internal-properties.schema.json(IDdefinition,minimum: 1)includes/class-scf-schema-builder.php:30(stale fallback comment)Reproduction
Covered by repro tests in #450:
tests/php/includes/abilities/test-scf-list-fields-schema-robustness.phptest_local_text_field_fails_output_schema_due_to_id_zerotest_single_drifted_field_invalidates_entire_list_outputAlso observed live as an order-dependent E2E failure before suite isolation was added (a stray malformed field bricked the listing for the whole run).
Suggested fix directions
oneOfvariant the schema-builder comment promises, and/orIDtominimum: 0(or document local fields' ID semantics), and/orlist_callbackso one bad field degrades to omission instead of total failure.Found during the 2026-06 test campaign (see PR #450).