Skip to content

Commit

Permalink
REST API: Update “object” strings to use the appropriate nouns.
Browse files Browse the repository at this point in the history
This updates route arguments and schema descriptions to use more specific object types for clarity.

Follow-up to [39342].

Props lephleg, jnylen0.
Fixes #40720.
Built from https://develop.svn.wordpress.org/trunk@51000


git-svn-id: http://core.svn.wordpress.org/trunk@50609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
SergeyBiryukov committed May 25, 2021
1 parent 670ec9c commit cc95428
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public function prepare_item_for_response( $item, $request ) {
}

/**
* Prepares links for the object.
* Prepares links for the request.
*
* @since 5.6.0
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function register_routes() {
'permission_callback' => array( $this, 'post_process_item_permissions_check' ),
'args' => array(
'id' => array(
'description' => __( 'Unique identifier for the object.' ),
'description' => __( 'Unique identifier for the attachment.' ),
'type' => 'integer',
),
'action' => array(
Expand Down Expand Up @@ -888,12 +888,12 @@ public function get_item_schema() {
),
'properties' => array(
'raw' => array(
'description' => __( 'Description for the object, as it exists in the database.' ),
'description' => __( 'Description for the attachment, as it exists in the database.' ),
'type' => 'string',
'context' => array( 'edit' ),
),
'rendered' => array(
'description' => __( 'HTML description for the object, transformed for display.' ),
'description' => __( 'HTML description for the attachment, transformed for display.' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function register_routes() {
array(
'args' => array(
'parent' => array(
'description' => __( 'The ID for the parent of the object.' ),
'description' => __( 'The ID for the parent of the autosave.' ),
'type' => 'integer',
),
),
Expand All @@ -112,11 +112,11 @@ public function register_routes() {
array(
'args' => array(
'parent' => array(
'description' => __( 'The ID for the parent of the object.' ),
'description' => __( 'The ID for the parent of the autosave.' ),
'type' => 'integer',
),
'id' => array(
'description' => __( 'The ID for the object.' ),
'description' => __( 'The ID for the autosave.' ),
'type' => 'integer',
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct() {
}

/**
* Registers the routes for the objects of the controller.
* Registers the routes for block types.
*
* @since 5.5.0
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct() {
}

/**
* Registers the routes for the objects of the controller.
* Registers the routes for comments.
*
* @since 4.7.0
*
Expand Down Expand Up @@ -71,7 +71,7 @@ public function register_routes() {
array(
'args' => array(
'id' => array(
'description' => __( 'Unique identifier for the object.' ),
'description' => __( 'Unique identifier for the comment.' ),
'type' => 'integer',
),
),
Expand Down Expand Up @@ -1381,7 +1381,7 @@ public function get_item_schema() {
'type' => 'object',
'properties' => array(
'id' => array(
'description' => __( 'Unique identifier for the object.' ),
'description' => __( 'Unique identifier for the comment.' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
Expand All @@ -1392,7 +1392,7 @@ public function get_item_schema() {
'context' => array( 'view', 'edit', 'embed' ),
),
'author_email' => array(
'description' => __( 'Email address for the object author.' ),
'description' => __( 'Email address for the comment author.' ),
'type' => 'string',
'format' => 'email',
'context' => array( 'edit' ),
Expand All @@ -1402,35 +1402,35 @@ public function get_item_schema() {
),
),
'author_ip' => array(
'description' => __( 'IP address for the object author.' ),
'description' => __( 'IP address for the comment author.' ),
'type' => 'string',
'format' => 'ip',
'context' => array( 'edit' ),
),
'author_name' => array(
'description' => __( 'Display name for the object author.' ),
'description' => __( 'Display name for the comment author.' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
'author_url' => array(
'description' => __( 'URL for the object author.' ),
'description' => __( 'URL for the comment author.' ),
'type' => 'string',
'format' => 'uri',
'context' => array( 'view', 'edit', 'embed' ),
),
'author_user_agent' => array(
'description' => __( 'User agent for the object author.' ),
'description' => __( 'User agent for the comment author.' ),
'type' => 'string',
'context' => array( 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
'content' => array(
'description' => __( 'The content for the object.' ),
'description' => __( 'The content for the comment.' ),
'type' => 'object',
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
Expand All @@ -1439,39 +1439,39 @@ public function get_item_schema() {
),
'properties' => array(
'raw' => array(
'description' => __( 'Content for the object, as it exists in the database.' ),
'description' => __( 'Content for the comment, as it exists in the database.' ),
'type' => 'string',
'context' => array( 'edit' ),
),
'rendered' => array(
'description' => __( 'HTML content for the object, transformed for display.' ),
'description' => __( 'HTML content for the comment, transformed for display.' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
),
),
),
'date' => array(
'description' => __( "The date the object was published, in the site's timezone." ),
'description' => __( "The date the comment was published, in the site's timezone." ),
'type' => 'string',
'format' => 'date-time',
'context' => array( 'view', 'edit', 'embed' ),
),
'date_gmt' => array(
'description' => __( 'The date the object was published, as GMT.' ),
'description' => __( 'The date the comment was published, as GMT.' ),
'type' => 'string',
'format' => 'date-time',
'context' => array( 'view', 'edit' ),
),
'link' => array(
'description' => __( 'URL to the object.' ),
'description' => __( 'URL to the comment.' ),
'type' => 'string',
'format' => 'uri',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
),
'parent' => array(
'description' => __( 'The ID for the parent of the object.' ),
'description' => __( 'The ID for the parent of the comment.' ),
'type' => 'integer',
'context' => array( 'view', 'edit', 'embed' ),
'default' => 0,
Expand All @@ -1483,15 +1483,15 @@ public function get_item_schema() {
'default' => 0,
),
'status' => array(
'description' => __( 'State of the object.' ),
'description' => __( 'State of the comment.' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_key',
),
),
'type' => array(
'description' => __( 'Type of Comment for the object.' ),
'description' => __( 'Type of the comment.' ),
'type' => 'string',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
Expand All @@ -1515,7 +1515,7 @@ public function get_item_schema() {
}

$schema['properties']['author_avatar_urls'] = array(
'description' => __( 'Avatar URLs for the object author.' ),
'description' => __( 'Avatar URLs for the comment author.' ),
'type' => 'object',
'context' => array( 'view', 'edit', 'embed' ),
'readonly' => true,
Expand Down Expand Up @@ -1611,7 +1611,7 @@ public function get_collection_params() {
);

$query_params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.' ),
'description' => __( 'Sort collection by comment attribute.' ),
'type' => 'string',
'default' => 'date_gmt',
'enum' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct() {
}

/**
* Registers the routes for the objects of the controller.
* Registers the routes for post statuses.
*
* @since 4.7.0
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct() {
}

/**
* Registers the routes for the objects of the controller.
* Registers the routes for post types.
*
* @since 4.7.0
*
Expand Down
Loading

0 comments on commit cc95428

Please sign in to comment.