Opened 4 years ago
Last modified 4 years ago
#53417 new defect (bug)
The revisions endpoints provide an incorrect JSON schema
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Revisions | Keywords: | needs-patch |
Focuses: | rest-api | Cc: |
Description (last modified by )
The schema provided by the REST API endpoints for revisions at wp/v2/posts/{id}/revisions
and wp/v2/pages/{id}/revisions
is incorrect. The schema states that content.protected
and excerpt.protected
properties exist for each revision, but these properties do not exist.
- The schema is constructed here from the parent controller for posts, which does include this property
- When the content data is prepared here the
protected
property is not included - When the excerpt data is prepared here the
protected
property is not included
Two options:
- Remove the
content.protected
andexcerpt.protected
properties from the schema - Add the
content.protected
andexcerpt.protected
properties to the response
Here is the content
property from the schema. Note the protected.context
property states that the property exists for all three contexts.
"content": { "description": "The content for the post.", "type": "object", "context": [ "view", "edit" ], "properties": { "raw": { "description": "Content for the post, as it exists in the database.", "type": "string", "context": [ "edit" ] }, "rendered": { "description": "HTML content for the post, transformed for display.", "type": "string", "context": [ "view", "edit" ], "readonly": true }, "block_version": { "description": "Version of the content block format used by the post.", "type": "integer", "context": [ "edit" ], "readonly": true }, "protected": { "description": "Whether the content is protected with a password.", "type": "boolean", "context": [ "view", "edit", "embed" ], "readonly": true } } },
Change History (3)
Note: See
TracTickets for help on using
tickets.
Update: the same applies to
excerpt.protected
too.