REST API: Clean up argument and property types.

There's a couple of places where we were missing type notes for arguments, which mainly affects documentation.

Props jnylen0.
Fixes #38792.

Built from https://develop.svn.wordpress.org/trunk@39250


git-svn-id: http://core.svn.wordpress.org/trunk@39190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe Hoyle 2016-11-15 18:16:30 +00:00
parent 19bb9c2fe0
commit d049f72459
6 changed files with 17 additions and 9 deletions

View File

@ -1158,6 +1158,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
'description' => __( 'HTML content for the object, transformed for display.' ), 'description' => __( 'HTML content for the object, transformed for display.' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ), 'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
), ),
), ),
), ),

View File

@ -205,10 +205,7 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
'properties' => array( 'properties' => array(
'capabilities' => array( 'capabilities' => array(
'description' => __( 'All capabilities used by the resource.' ), 'description' => __( 'All capabilities used by the resource.' ),
'type' => 'array', 'type' => 'object',
'items' => array(
'type' => 'string',
),
'context' => array( 'edit' ), 'context' => array( 'edit' ),
'readonly' => true, 'readonly' => true,
), ),

View File

@ -86,6 +86,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
'context' => $this->get_context_param( array( 'default' => 'view' ) ), 'context' => $this->get_context_param( array( 'default' => 'view' ) ),
'password' => array( 'password' => array(
'description' => __( 'The password for the post if it is password protected.' ), 'description' => __( 'The password for the post if it is password protected.' ),
'type' => 'string',
), ),
), ),
), ),
@ -2069,6 +2070,9 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
$params['slug'] = array( $params['slug'] = array(
'description' => __( 'Limit result set to posts with one or more specific slugs.' ), 'description' => __( 'Limit result set to posts with one or more specific slugs.' ),
'type' => 'array', 'type' => 'array',
'items' => array(
'type' => 'string',
),
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
); );

View File

@ -236,7 +236,7 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
'properties' => array( 'properties' => array(
'capabilities' => array( 'capabilities' => array(
'description' => __( 'All capabilities used by the resource.' ), 'description' => __( 'All capabilities used by the resource.' ),
'type' => 'array', 'type' => 'object',
'context' => array( 'edit' ), 'context' => array( 'edit' ),
'readonly' => true, 'readonly' => true,
), ),

View File

@ -89,7 +89,10 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
'default' => false, 'default' => false,
'description' => __( 'Required to be true, as resource does not support trashing.' ), 'description' => __( 'Required to be true, as resource does not support trashing.' ),
), ),
'reassign' => array(), 'reassign' => array(
'type' => 'integer',
'description' => __( 'Reassign the deleted user\'s posts and links to this user ID.' ),
),
), ),
), ),
'schema' => array( $this, 'get_public_item_schema' ), 'schema' => array( $this, 'get_public_item_schema' ),
@ -100,7 +103,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_current_item' ), 'callback' => array( $this, 'get_current_item' ),
'args' => array( 'args' => array(
'context' => array(), 'context' => $this->get_context_param( array( 'default' => 'view' ) ),
), ),
), ),
array( array(
@ -119,7 +122,10 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
'default' => false, 'default' => false,
'description' => __( 'Required to be true, as resource does not support trashing.' ), 'description' => __( 'Required to be true, as resource does not support trashing.' ),
), ),
'reassign' => array(), 'reassign' => array(
'type' => 'integer',
'description' => __( 'Reassign the deleted user\'s posts and links to this user ID.' ),
),
), ),
), ),
'schema' => array( $this, 'get_public_item_schema' ), 'schema' => array( $this, 'get_public_item_schema' ),

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta3-39249'; $wp_version = '4.7-beta3-39250';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.