<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[44250] trunk/tests: REST API: Avoid using 'parent' as path argument name for autosaves.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/44250">44250</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/44250","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-12-17 00:23:55 +0000 (Mon, 17 Dec 2018)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>REST API: Avoid using 'parent' as path argument name for autosaves.

When 'parent' is set as the path argument name, it gets passed down through to the `create_item()` method and can erroneously reset the 'parent' value on the post itself. Instead, we rename the argument to 'id' and replicate the revision controller's `get_items_permissions_check()` to instead reference 'id'.

Also ensures revision query params (of which there are many) aren't exposed as the query params for autosaves (of which there are two).

Props TimothyBlynJacobs.
Merges <a href="https://core.trac.wordpress.org/changeset/43897">[43897]</a> to trunk.
See <a href="https://core.trac.wordpress.org/ticket/43316">#43316</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestautosavescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestautosavescontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestschemasetupphp">trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</a></li>
<li><a href="#trunktestsqunitfixtureswpapigeneratedjs">trunk/tests/qunit/fixtures/wp-api-generated.js</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunk">trunk/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk        2018-12-17 00:14:27 UTC (rev 44249)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk 2018-12-17 00:23:55 UTC (rev 44250)
</ins><a id="trunk"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:43557,43622
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43860,43862,43867-43883,43885-43887,43889,43892-43894,43898-43900,43902,43904,43909,43912,43926-43929,43954,43956,43961-43963,44014,44017
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43860,43862,43867-43883,43885-43887,43889,43892-43894,43897-43900,43902,43904,43909,43912,43926-43929,43954,43956,43961-43963,44014,44017
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpincludesrestapiendpointsclasswprestautosavescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php   2018-12-17 00:14:27 UTC (rev 44249)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php     2018-12-17 00:23:55 UTC (rev 44250)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,7 +79,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function register_routes() {
</span><span class="cx" style="display: block; padding: 0 10px">                register_rest_route(
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->rest_namespace,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        '/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 '/' . $this->parent_base . '/(?P<id>[\d]+)/' . $this->rest_base,
</ins><span class="cx" style="display: block; padding: 0 10px">                         array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'args'   => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'parent' => array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -90,7 +90,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'methods'             => WP_REST_Server::READABLE,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'callback'            => array( $this, 'get_items' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'permission_callback' => array( $this->revisions_controller, 'get_items_permissions_check' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'permission_callback' => array( $this, 'get_items_permissions_check' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'args'                => $this->get_collection_params(),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,7 +97,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'methods'             => WP_REST_Server::CREATABLE,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'callback'            => array( $this, 'create_item' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'permission_callback' => array( $this, 'create_item_permissions_check' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'args'                => $this->parent_controller->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'schema' => array( $this, 'get_public_item_schema' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,6 +144,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Checks if a given request has access to get autosaves.
+        *
+        * @since 5.0.0
+        *
+        * @param WP_REST_Request $request Full data about the request.
+        * @return true|WP_Error True if the request has read access, WP_Error object otherwise.
+        */
+       public function get_items_permissions_check( $request ) {
+               $parent = $this->get_parent( $request['id'] );
+               if ( is_wp_error( $parent ) ) {
+                       return $parent;
+               }
+
+               $parent_post_type_obj = get_post_type_object( $parent->post_type );
+               if ( ! current_user_can( $parent_post_type_obj->cap->edit_post, $parent->ID ) ) {
+                       return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to view autosaves of this post.' ), array( 'status' => rest_authorization_required_code() ) );
+               }
+
+               return true;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Checks if a given request has access to create an autosave revision.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * Autosave revisions inherit permissions from the parent post,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -177,7 +199,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        define( 'DOING_AUTOSAVE', true );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $post = get_post( $request->get_param( 'id' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $post = get_post( $request['id'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( is_wp_error( $post ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return $post;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -245,7 +267,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function get_items( $request ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $parent = $this->get_parent( $request->get_param( 'parent' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $parent = $this->get_parent( $request['id'] );
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( is_wp_error( $parent ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return $parent;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -389,4 +411,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                return apply_filters( 'rest_prepare_autosave', $response, $post, $request );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Retrieves the query params for the autosaves collection.
+        *
+        * @since 5.0.0
+        *
+        * @return array Collection parameters.
+        */
+       public function get_collection_params() {
+               return array(
+                       'context' => $this->get_context_param( array( 'default' => 'view' ) ),
+               );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestautosavescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php  2018-12-17 00:14:27 UTC (rev 44249)
+++ trunk/tests/phpunit/tests/rest-api/rest-autosaves-controller.php    2018-12-17 00:23:55 UTC (rev 44250)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,6 +13,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_Test_REST_Autosaves_Controller extends WP_Test_REST_Post_Type_Controller_Testcase {
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $post_id;
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $page_id;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        protected static $draft_page_id;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $autosave_post_id;
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $autosave_page_id;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,6 +21,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $editor_id;
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $contributor_id;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        protected static $parent_page_id;
+       protected static $child_page_id;
+       protected static $child_draft_page_id;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         protected function set_post_data( $args = array() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $defaults = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'title'   => 'Post Title',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,6 +81,25 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                self::$draft_page_id       = $factory->post->create( array(
+                       'post_type'   => 'page',
+                       'post_status' => 'draft',
+               ) );
+               self::$parent_page_id      = $factory->post->create( array(
+                       'post_type' => 'page',
+               ) );
+               self::$child_page_id       = $factory->post->create( array(
+                       'post_type'   => 'page',
+                       'post_parent' => self::$parent_page_id,
+               ) );
+               self::$child_draft_page_id = $factory->post->create( array(
+                       'post_type'   => 'page',
+                       'post_parent' => self::$parent_page_id,
+                       // The "update post" behavior of the autosave endpoint only occurs
+                       // when saving a draft/auto-draft authored by the current user.
+                       'post_status' => 'draft',
+                       'post_author' => self::$editor_id,
+               ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public static function wpTearDownAfterClass() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,9 +120,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_register_routes() {
</span><span class="cx" style="display: block; padding: 0 10px">                $routes = rest_get_server()->get_routes();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertArrayHasKey( '/wp/v2/posts/(?P<parent>[\d]+)/autosaves', $routes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertArrayHasKey( '/wp/v2/posts/(?P<id>[\d]+)/autosaves', $routes );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertArrayHasKey( '/wp/v2/posts/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)', $routes );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertArrayHasKey( '/wp/v2/pages/(?P<parent>[\d]+)/autosaves', $routes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertArrayHasKey( '/wp/v2/pages/(?P<id>[\d]+)/autosaves', $routes );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertArrayHasKey( '/wp/v2/pages/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)', $routes );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,6 +143,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEqualSets( array( 'view', 'edit', 'embed' ), $data['endpoints'][0]['args']['context']['enum'] );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public function test_registered_query_params() {
+               $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
+               $response = $this->server->dispatch( $request );
+               $data = $response->get_data();
+               $keys = array_keys( $data['endpoints'][0]['args'] );
+               sort( $keys );
+               $this->assertEquals( array(
+                       'context',
+                       'parent',
+               ), $keys );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function test_get_items() {
</span><span class="cx" style="display: block; padding: 0 10px">                wp_set_current_user( self::$editor_id );
</span><span class="cx" style="display: block; padding: 0 10px">                $request  = new WP_REST_Request( 'GET', '/wp/v2/posts/' . self::$post_id . '/autosaves' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -517,4 +553,40 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( $parent_post_id, self::$post_id );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public function test_update_item_draft_page_with_parent() {
+               wp_set_current_user( self::$editor_id );
+               $request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$child_draft_page_id . '/autosaves' );
+               $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
+
+               $params = $this->set_post_data(
+                       array(
+                               'id'     => self::$child_draft_page_id,
+                               'author' => self::$editor_id,
+                       )
+               );
+
+               $request->set_body_params( $params );
+               $response = rest_get_server()->dispatch( $request );
+               $data     = $response->get_data();
+
+               $this->assertEquals( self::$child_draft_page_id, $data['id'] );
+               $this->assertEquals( self::$parent_page_id, $data['parent'] );
+       }
+
+       public function test_schema_validation_is_applied() {
+               wp_set_current_user( self::$editor_id );
+
+               $request = new WP_REST_Request( 'POST', '/wp/v2/pages/' . self::$draft_page_id . '/autosaves' );
+               $request->add_header( 'content-type', 'application/x-www-form-urlencoded' );
+
+               $params = $this->set_post_data( array(
+                       'id' => self::$draft_page_id,
+                       'comment_status' => 'garbage',
+               ) );
+
+               $request->set_body_params( $params );
+
+               $response = rest_get_server()->dispatch( $request );
+               $this->assertNotEquals( 'garbage', get_post( self::$draft_page_id )->comment_status );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestschemasetupphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php  2018-12-17 00:14:27 UTC (rev 44249)
+++ trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php    2018-12-17 00:23:55 UTC (rev 44250)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -89,19 +89,19 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/posts/(?P<id>[\\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/posts/(?P<parent>[\\d]+)/revisions',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/posts/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        '/wp/v2/posts/(?P<parent>[\\d]+)/autosaves',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 '/wp/v2/posts/(?P<id>[\\d]+)/autosaves',
</ins><span class="cx" style="display: block; padding: 0 10px">                         '/wp/v2/posts/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/pages',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/pages/(?P<id>[\\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/pages/(?P<parent>[\\d]+)/revisions',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/pages/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        '/wp/v2/pages/(?P<parent>[\\d]+)/autosaves',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 '/wp/v2/pages/(?P<id>[\\d]+)/autosaves',
</ins><span class="cx" style="display: block; padding: 0 10px">                         '/wp/v2/pages/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/media',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/media/(?P<id>[\\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/blocks',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/blocks/(?P<id>[\d]+)',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        '/wp/v2/blocks/(?P<parent>[\d]+)/autosaves',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 '/wp/v2/blocks/(?P<id>[\d]+)/autosaves',
</ins><span class="cx" style="display: block; padding: 0 10px">                         '/wp/v2/blocks/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/types',
</span><span class="cx" style="display: block; padding: 0 10px">                        '/wp/v2/types/(?P<type>[\\w-]+)',
</span></span></pre></div>
<a id="trunktestsqunitfixtureswpapigeneratedjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/fixtures/wp-api-generated.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/fixtures/wp-api-generated.js    2018-12-17 00:14:27 UTC (rev 44249)
+++ trunk/tests/qunit/fixtures/wp-api-generated.js      2018-12-17 00:23:55 UTC (rev 44250)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -850,7 +850,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">             ]
</span><span class="cx" style="display: block; padding: 0 10px">         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "/wp/v2/posts/(?P<parent>[\\d]+)/autosaves": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "/wp/v2/posts/(?P<id>[\\d]+)/autosaves": {
</ins><span class="cx" style="display: block; padding: 0 10px">             "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px">             "methods": [
</span><span class="cx" style="display: block; padding: 0 10px">                 "GET",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -877,70 +877,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             ],
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "Scope under which the request is made; determines fields present in response.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        },
-                        "page": {
-                            "required": false,
-                            "default": 1,
-                            "description": "Current page of the collection.",
-                            "type": "integer"
-                        },
-                        "per_page": {
-                            "required": false,
-                            "description": "Maximum number of items to be returned in result set.",
-                            "type": "integer"
-                        },
-                        "search": {
-                            "required": false,
-                            "description": "Limit results to those matching a string.",
-                            "type": "string"
-                        },
-                        "exclude": {
-                            "required": false,
-                            "default": [],
-                            "description": "Ensure result set excludes specific IDs.",
-                            "type": "array",
-                            "items": {
-                                "type": "integer"
-                            }
-                        },
-                        "include": {
-                            "required": false,
-                            "default": [],
-                            "description": "Limit result set to specific IDs.",
-                            "type": "array",
-                            "items": {
-                                "type": "integer"
-                            }
-                        },
-                        "offset": {
-                            "required": false,
-                            "description": "Offset the result set by a specific number of items.",
-                            "type": "integer"
-                        },
-                        "order": {
-                            "required": false,
-                            "default": "desc",
-                            "enum": [
-                                "asc",
-                                "desc"
-                            ],
-                            "description": "Order sort attribute ascending or descending.",
-                            "type": "string"
-                        },
-                        "orderby": {
-                            "required": false,
-                            "default": "date",
-                            "enum": [
-                                "date",
-                                "id",
-                                "include",
-                                "relevance",
-                                "slug",
-                                "include_slugs",
-                                "title"
-                            ],
-                            "description": "Sort collection by object attribute.",
-                            "type": "string"
</del><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                     }
</span><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -954,11 +890,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The ID for the parent of the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "integer"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "author": {
-                            "required": false,
-                            "description": "The ID for the author of the object.",
-                            "type": "integer"
-                        },
</del><span class="cx" style="display: block; padding: 0 10px">                         "date": {
</span><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The date the object was published, in the site's timezone.",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -969,24 +900,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The date the object was published, as GMT.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "id": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "slug": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "Unique identifier for the object.",
-                            "type": "integer"
-                        },
-                        "modified": {
-                            "required": false,
-                            "description": "The date the object was last modified, in the site's timezone.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "description": "An alphanumeric identifier for the object unique to its type.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "modified_gmt": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "status": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "The date the object was last modified, as GMT.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "enum": [
+                                "publish",
+                                "future",
+                                "draft",
+                                "pending",
+                                "private"
+                            ],
+                            "description": "A named status for the object.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "slug": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "password": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "An alphanumeric identifier for the object unique to its type.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "description": "A password to protect access to the content and excerpt.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><span class="cx" style="display: block; padding: 0 10px">                         "title": {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -999,10 +932,86 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The content for the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "object"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "author": {
+                            "required": false,
+                            "description": "The ID for the author of the object.",
+                            "type": "integer"
+                        },
</ins><span class="cx" style="display: block; padding: 0 10px">                         "excerpt": {
</span><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The excerpt for the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "object"
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        },
+                        "featured_media": {
+                            "required": false,
+                            "description": "The ID of the featured media for the object.",
+                            "type": "integer"
+                        },
+                        "comment_status": {
+                            "required": false,
+                            "enum": [
+                                "open",
+                                "closed"
+                            ],
+                            "description": "Whether or not comments are open on the object.",
+                            "type": "string"
+                        },
+                        "ping_status": {
+                            "required": false,
+                            "enum": [
+                                "open",
+                                "closed"
+                            ],
+                            "description": "Whether or not the object can be pinged.",
+                            "type": "string"
+                        },
+                        "format": {
+                            "required": false,
+                            "enum": [
+                                "standard",
+                                "aside",
+                                "chat",
+                                "gallery",
+                                "link",
+                                "image",
+                                "quote",
+                                "status",
+                                "video",
+                                "audio"
+                            ],
+                            "description": "The format for the object.",
+                            "type": "string"
+                        },
+                        "meta": {
+                            "required": false,
+                            "description": "Meta fields.",
+                            "type": "object"
+                        },
+                        "sticky": {
+                            "required": false,
+                            "description": "Whether or not the object should be treated as sticky.",
+                            "type": "boolean"
+                        },
+                        "template": {
+                            "required": false,
+                            "description": "The theme file to use to display the object.",
+                            "type": "string"
+                        },
+                        "categories": {
+                            "required": false,
+                            "description": "The terms assigned to the object in the category taxonomy.",
+                            "type": "array",
+                            "items": {
+                                "type": "integer"
+                            }
+                        },
+                        "tags": {
+                            "required": false,
+                            "description": "The terms assigned to the object in the post_tag taxonomy.",
+                            "type": "array",
+                            "items": {
+                                "type": "integer"
+                            }
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                     }
</span><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1650,7 +1659,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">             ]
</span><span class="cx" style="display: block; padding: 0 10px">         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "/wp/v2/pages/(?P<parent>[\\d]+)/autosaves": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "/wp/v2/pages/(?P<id>[\\d]+)/autosaves": {
</ins><span class="cx" style="display: block; padding: 0 10px">             "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px">             "methods": [
</span><span class="cx" style="display: block; padding: 0 10px">                 "GET",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1677,70 +1686,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             ],
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "Scope under which the request is made; determines fields present in response.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        },
-                        "page": {
-                            "required": false,
-                            "default": 1,
-                            "description": "Current page of the collection.",
-                            "type": "integer"
-                        },
-                        "per_page": {
-                            "required": false,
-                            "description": "Maximum number of items to be returned in result set.",
-                            "type": "integer"
-                        },
-                        "search": {
-                            "required": false,
-                            "description": "Limit results to those matching a string.",
-                            "type": "string"
-                        },
-                        "exclude": {
-                            "required": false,
-                            "default": [],
-                            "description": "Ensure result set excludes specific IDs.",
-                            "type": "array",
-                            "items": {
-                                "type": "integer"
-                            }
-                        },
-                        "include": {
-                            "required": false,
-                            "default": [],
-                            "description": "Limit result set to specific IDs.",
-                            "type": "array",
-                            "items": {
-                                "type": "integer"
-                            }
-                        },
-                        "offset": {
-                            "required": false,
-                            "description": "Offset the result set by a specific number of items.",
-                            "type": "integer"
-                        },
-                        "order": {
-                            "required": false,
-                            "default": "desc",
-                            "enum": [
-                                "asc",
-                                "desc"
-                            ],
-                            "description": "Order sort attribute ascending or descending.",
-                            "type": "string"
-                        },
-                        "orderby": {
-                            "required": false,
-                            "default": "date",
-                            "enum": [
-                                "date",
-                                "id",
-                                "include",
-                                "relevance",
-                                "slug",
-                                "include_slugs",
-                                "title"
-                            ],
-                            "description": "Sort collection by object attribute.",
-                            "type": "string"
</del><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                     }
</span><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1754,11 +1699,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The ID for the parent of the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "integer"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "author": {
-                            "required": false,
-                            "description": "The ID for the author of the object.",
-                            "type": "integer"
-                        },
</del><span class="cx" style="display: block; padding: 0 10px">                         "date": {
</span><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The date the object was published, in the site's timezone.",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1769,24 +1709,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The date the object was published, as GMT.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "id": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "slug": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "Unique identifier for the object.",
-                            "type": "integer"
-                        },
-                        "modified": {
-                            "required": false,
-                            "description": "The date the object was last modified, in the site's timezone.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "description": "An alphanumeric identifier for the object unique to its type.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "modified_gmt": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "status": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "The date the object was last modified, as GMT.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "enum": [
+                                "publish",
+                                "future",
+                                "draft",
+                                "pending",
+                                "private"
+                            ],
+                            "description": "A named status for the object.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "slug": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "password": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "An alphanumeric identifier for the object unique to its type.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "description": "A password to protect access to the content and excerpt.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><span class="cx" style="display: block; padding: 0 10px">                         "title": {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1799,10 +1741,53 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The content for the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "object"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "author": {
+                            "required": false,
+                            "description": "The ID for the author of the object.",
+                            "type": "integer"
+                        },
</ins><span class="cx" style="display: block; padding: 0 10px">                         "excerpt": {
</span><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The excerpt for the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "object"
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        },
+                        "featured_media": {
+                            "required": false,
+                            "description": "The ID of the featured media for the object.",
+                            "type": "integer"
+                        },
+                        "comment_status": {
+                            "required": false,
+                            "enum": [
+                                "open",
+                                "closed"
+                            ],
+                            "description": "Whether or not comments are open on the object.",
+                            "type": "string"
+                        },
+                        "ping_status": {
+                            "required": false,
+                            "enum": [
+                                "open",
+                                "closed"
+                            ],
+                            "description": "Whether or not the object can be pinged.",
+                            "type": "string"
+                        },
+                        "menu_order": {
+                            "required": false,
+                            "description": "The order of the object in relation to other object of its type.",
+                            "type": "integer"
+                        },
+                        "meta": {
+                            "required": false,
+                            "description": "Meta fields.",
+                            "type": "object"
+                        },
+                        "template": {
+                            "required": false,
+                            "description": "The theme file to use to display the object.",
+                            "type": "string"
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                     }
</span><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2584,7 +2569,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">             ]
</span><span class="cx" style="display: block; padding: 0 10px">         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "/wp/v2/blocks/(?P<parent>[\\d]+)/autosaves": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "/wp/v2/blocks/(?P<id>[\\d]+)/autosaves": {
</ins><span class="cx" style="display: block; padding: 0 10px">             "namespace": "wp/v2",
</span><span class="cx" style="display: block; padding: 0 10px">             "methods": [
</span><span class="cx" style="display: block; padding: 0 10px">                 "GET",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2611,70 +2596,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             ],
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "Scope under which the request is made; determines fields present in response.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        },
-                        "page": {
-                            "required": false,
-                            "default": 1,
-                            "description": "Current page of the collection.",
-                            "type": "integer"
-                        },
-                        "per_page": {
-                            "required": false,
-                            "description": "Maximum number of items to be returned in result set.",
-                            "type": "integer"
-                        },
-                        "search": {
-                            "required": false,
-                            "description": "Limit results to those matching a string.",
-                            "type": "string"
-                        },
-                        "exclude": {
-                            "required": false,
-                            "default": [],
-                            "description": "Ensure result set excludes specific IDs.",
-                            "type": "array",
-                            "items": {
-                                "type": "integer"
-                            }
-                        },
-                        "include": {
-                            "required": false,
-                            "default": [],
-                            "description": "Limit result set to specific IDs.",
-                            "type": "array",
-                            "items": {
-                                "type": "integer"
-                            }
-                        },
-                        "offset": {
-                            "required": false,
-                            "description": "Offset the result set by a specific number of items.",
-                            "type": "integer"
-                        },
-                        "order": {
-                            "required": false,
-                            "default": "desc",
-                            "enum": [
-                                "asc",
-                                "desc"
-                            ],
-                            "description": "Order sort attribute ascending or descending.",
-                            "type": "string"
-                        },
-                        "orderby": {
-                            "required": false,
-                            "default": "date",
-                            "enum": [
-                                "date",
-                                "id",
-                                "include",
-                                "relevance",
-                                "slug",
-                                "include_slugs",
-                                "title"
-                            ],
-                            "description": "Sort collection by object attribute.",
-                            "type": "string"
</del><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                     }
</span><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2688,11 +2609,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The ID for the parent of the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "integer"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "author": {
-                            "required": false,
-                            "description": "The ID for the author of the object.",
-                            "type": "integer"
-                        },
</del><span class="cx" style="display: block; padding: 0 10px">                         "date": {
</span><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The date the object was published, in the site's timezone.",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2703,24 +2619,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The date the object was published, as GMT.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "id": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "slug": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "Unique identifier for the object.",
-                            "type": "integer"
-                        },
-                        "modified": {
-                            "required": false,
-                            "description": "The date the object was last modified, in the site's timezone.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "description": "An alphanumeric identifier for the object unique to its type.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "modified_gmt": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "status": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "The date the object was last modified, as GMT.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "enum": [
+                                "publish",
+                                "future",
+                                "draft",
+                                "pending",
+                                "private"
+                            ],
+                            "description": "A named status for the object.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "slug": {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "password": {
</ins><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                            "description": "An alphanumeric identifier for the object unique to its type.",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                            "description": "A password to protect access to the content and excerpt.",
</ins><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="cx" style="display: block; padding: 0 10px">                         },
</span><span class="cx" style="display: block; padding: 0 10px">                         "title": {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2732,6 +2650,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "The content for the object.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "object"
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        },
+                        "template": {
+                            "required": false,
+                            "description": "The theme file to use to display the object.",
+                            "type": "string"
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                     }
</span><span class="cx" style="display: block; padding: 0 10px">                 }
</span></span></pre>
</div>
</div>

</body>
</html>