Opened 6 weeks ago
Last modified 5 weeks ago
#64168 new defect (bug)
Inaccurate JSON schema for template-parts endpoint
| Reported by: |
|
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:
- The
originproperty can benullas well as a string. This property maps directly toWP_Block_Template::originwhich isstring|null. - The
modifiedproperty can befalseas 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
Note: See
TracTickets for help on using
tickets.
Fix as suggested by John