[wp-trac] [WordPress Trac] #53417: The revisions endpoints provide an incorrect JSON schema
WordPress Trac
noreply at wordpress.org
Tue Jun 15 23:24:51 UTC 2021
#53417: The revisions endpoints provide an incorrect JSON schema
--------------------------+------------------------------
Reporter: johnbillion | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Revisions | Version: 4.7
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: rest-api
--------------------------+------------------------------
Description changed by johnbillion:
Old description:
> 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 a `content.protected` property exists
> for each revision, but this property does not exist.
>
> * [https://github.com/WordPress/wordpress-
> develop/blob/afee26086fea307c2a5c31c0e2018cb6acd598f7/src/wp-includes
> /rest-api/endpoints/class-wp-rest-revisions-controller.php#L736 The
> schema is constructed here] from the parent controller for posts, which
> does include this property
> * [https://github.com/WordPress/wordpress-
> develop/blob/afee26086fea307c2a5c31c0e2018cb6acd598f7/src/wp-includes
> /rest-api/endpoints/class-wp-rest-revisions-controller.php#L600-L604 When
> the data is prepared here] the `protected` property is not included
>
> Two options:
>
> 1. Remove the `content.protected` property from the schema
> 2. Add the `content.protected` property to the response
>
> Here is the `content` property from the schema. Note the `context`
> property states that the `protected` 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
> }
> }
> },
> }}}
New description:
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 a `content.protected` property exists
for each revision, but this property does not exist.
* [https://github.com/WordPress/wordpress-
develop/blob/afee26086fea307c2a5c31c0e2018cb6acd598f7/src/wp-includes
/rest-api/endpoints/class-wp-rest-revisions-controller.php#L736 The schema
is constructed here] from the parent controller for posts, which does
include this property
* [https://github.com/WordPress/wordpress-
develop/blob/afee26086fea307c2a5c31c0e2018cb6acd598f7/src/wp-includes
/rest-api/endpoints/class-wp-rest-revisions-controller.php#L600-L604 When
the data is prepared here] the `protected` property is not included
Two options:
1. Remove the `content.protected` property from the schema
2. Add the `content.protected` property 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
}
}
},
}}}
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53417#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list