WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 23 months ago

#41605 new defect (bug)

REST API: Fixed schema for the Page post type is incorrect

Reported by: johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch has-unit-tests dev-feedback
Focuses: rest-api Cc:
PR Number:

Description

The fixed schema for the page post type incorrectly states that it supports the excerpt field. It does not.

Ref: https://github.com/WordPress/wordpress-develop/blob/d570de32ca3a5f623bf26d70dfc55141c339073d/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L1801-L1831

In addition, I'm not sure why the schemas for the Post, Page, and Attachment post types are hard-coded instead of relying on post type support.

Attachments (1)

41605.patch (3.2 KB) - added by johnbillion 2 years ago.

Download all attachments as: .zip

Change History (6)

@johnbillion
2 years ago

#1 @johnbillion
2 years ago

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

#2 @johnbillion
2 years ago

Hmm, the attachment post type also states that it supports custom-fields, which it does not.

#3 @danielbachhuber
2 years ago

I'm not sure why the schemas for the Post, Page, and Attachment post types are hard-coded instead of relying on post type support.

The idea here was that core post types would always have a fixed schema:

I suspect the original conversation is in Slack somewhere...

#4 @johnbillion
2 years ago

Removing the excerpt field from the response when querying Pages could be considered a breaking change. What's the best path forward?

#5 @joehoyle
23 months ago

Woops, I guess we made them all adhere to an incorrect schema at the beginning. I don't know if there's much we can do about this now. Maybe make them read-only?

Note: See TracTickets for help on using tickets.