WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 6 weeks ago

#53417 new defect (bug)

The revisions endpoints provide an incorrect JSON schema

Reported by: johnbillion 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 johnbillion)

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.

Two options:

  1. Remove the content.protected and excerpt.protected properties from the schema
  2. Add the content.protected and excerpt.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)

#1 @johnbillion
6 weeks ago

  • Description modified (diff)

#2 @johnbillion
6 weeks ago

  • Description modified (diff)

#3 @johnbillion
6 weeks ago

  • Description modified (diff)

Update: the same applies to excerpt.protected too.

Note: See TracTickets for help on using tickets.