[wp-trac] [WordPress Trac] #64926: REST API: GET requests fail object/array schema validation when params are JSON-serialized strings

WordPress Trac noreply at wordpress.org
Thu Apr 9 03:07:43 UTC 2026


#64926: REST API: GET requests fail object/array schema validation when params are
JSON-serialized strings
-------------------------+-------------------------------------------------
 Reporter:  dsmy         |       Owner:  (none)
     Type:  defect       |      Status:  new
  (bug)                  |
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  REST API     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  javascript, rest-api, php-
                         |  compatibility
-------------------------+-------------------------------------------------

Comment (by liaison):

 @westonruter, @dsmy Thanks for sharing the context about the Abilities
 API.

 The Abilities API and @wordpress/abilities provide a structured interface
 for the WordPress ecosystem (like Gutenberg). By using the package,
 developers benefit from API encapsulation and schema-driven validation, as
 well as:

 Security: Execution via this package respects WordPress's built-in
 permission callbacks.

 State Management: Deep integration with Data Store and Caching for the
 Gutenberg Editor.

 Context Awareness: Improved handling for Multisite environments and
 metadata annotations.

 Implementing json_decode directly in rest-api.php provides a more
 "universal" approach. This keeps the REST API decoupled from any specific
 client-side library, which is essential for:

 Diverse Clients: AI agents (via MCP), standalone scripts, or headless SPAs
 that may not load the @wordpress/abilities package but still need to pass
 complex data via GET requests.

 Infrastructure Robustness: It ensures JSON-encoded strings are correctly
 parsed into types that match the input_schema, preventing validation
 errors during the raw REST path.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64926#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list