Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#64168 new defect (bug)

Inaccurate JSON schema for template-parts endpoint

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.8
Component: REST API Keywords: good-first-bug has-patch has-unit-tests
Focuses: Cc:

Description

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 ),
	)
),

Change History (1)

This ticket was mentioned in PR #10441 on WordPress/wordpress-develop by @nimeshatxecurify.


5 weeks ago
#1

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed

Fix as suggested by John

Note: See TracTickets for help on using tickets.