[wp-trac] [WordPress Trac] #64168: Inaccurate JSON schema for template-parts endpoint

WordPress Trac noreply at wordpress.org
Wed Oct 29 12:59:11 UTC 2025


#64168: Inaccurate JSON schema for template-parts endpoint
-------------------------+-------------------------------------------------
 Reporter:  johnbillion  |      Owner:  (none)
     Type:  defect       |     Status:  new
  (bug)                  |
 Priority:  normal       |  Milestone:  Future Release
Component:  REST API     |    Version:  5.8
 Severity:  normal       |   Keywords:  needs-patch needs-unit-tests good-
  Focuses:               |  first-bug
-------------------------+-------------------------------------------------
 The schema provided by the `wp/v2/template-parts` REST API endpoint has
 some inaccuracies:

 1. The `origin` property can be `null` as well as a string. This property
 maps directly to `WP_Block_Template::origin` which is `string|null`.
 2. The `modified` property can be `false` as well as a date-time string.


 Both of these properties can be seen with null/false values by performing
 an authenticated request to `/wp/v2/template-parts` on a freshly installed
 vanilla WordPress site.

 Any updates will need unit test coverage.

 Here's an untested update to the `modified` property to replace its type
 and format.

 {{{
 'oneOf' => array(
         array(
                 'type'   => 'string',
                 'format' => 'date-time'
         ),
         array(
                 'type' => 'boolean',
                 'enum' => array( false ),
         )
 ),
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64168>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list