Changeset 45811
- Timestamp:
- 08/15/2019 09:08:05 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r44934 r45811 418 418 */ 419 419 public function get_item_schema() { 420 if ( $this->schema ) { 421 return $this->add_additional_fields_schema( $this->schema ); 422 } 420 423 421 424 $schema = parent::get_item_schema(); … … 514 517 unset( $schema['properties']['password'] ); 515 518 516 return $schema; 519 $this->schema = $schema; 520 return $this->add_additional_fields_schema( $this->schema ); 517 521 } 518 522 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
r45444 r45811 297 297 */ 298 298 public function get_item_schema() { 299 if ( $this->schema ) { 300 return $this->add_additional_fields_schema( $this->schema ); 301 } 302 299 303 $schema = $this->revisions_controller->get_item_schema(); 300 304 … … 307 311 ); 308 312 309 return $schema; 313 $this->schema = $schema; 314 return $this->add_additional_fields_schema( $this->schema ); 310 315 } 311 316 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php
r44269 r45811 162 162 */ 163 163 public function get_item_schema() { 164 return array( 164 if ( $this->schema ) { 165 return $this->schema; 166 } 167 168 $this->schema = array( 165 169 '$schema' => 'http://json-schema.org/schema#', 166 170 'title' => 'rendered-block', … … 175 179 ), 176 180 ); 181 return $this->schema; 177 182 } 178 183 } -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php
r44268 r45811 69 69 */ 70 70 public function get_item_schema() { 71 // Do not cache this schema because all properties are derived from parent controller. 71 72 $schema = parent::get_item_schema(); 72 73 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
r45632 r45811 1216 1216 */ 1217 1217 public function get_item_schema() { 1218 if ( $this->schema ) { 1219 return $this->add_additional_fields_schema( $this->schema ); 1220 } 1221 1218 1222 $schema = array( 1219 1223 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 1365 1369 $schema['properties']['meta'] = $this->meta->get_field_schema(); 1366 1370 1367 return $this->add_additional_fields_schema( $schema ); 1371 $this->schema = $schema; 1372 return $this->add_additional_fields_schema( $this->schema ); 1368 1373 } 1369 1374 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
r45810 r45811 30 30 */ 31 31 protected $rest_base; 32 33 /** 34 * Cached results of get_item_schema. 35 * 36 * @since 5.3.0 37 * @var array 38 */ 39 protected $schema; 32 40 33 41 /** -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php
r43571 r45811 269 269 */ 270 270 public function get_item_schema() { 271 if ( $this->schema ) { 272 return $this->add_additional_fields_schema( $this->schema ); 273 } 274 271 275 $schema = array( 272 276 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 319 323 ); 320 324 321 return $this->add_additional_fields_schema( $schema ); 325 $this->schema = $schema; 326 return $this->add_additional_fields_schema( $this->schema ); 322 327 } 323 328 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php
r43571 r45811 243 243 */ 244 244 public function get_item_schema() { 245 if ( $this->schema ) { 246 return $this->add_additional_fields_schema( $this->schema ); 247 } 248 245 249 $schema = array( 246 250 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 313 317 ), 314 318 ); 315 return $this->add_additional_fields_schema( $schema ); 319 320 $this->schema = $schema; 321 return $this->add_additional_fields_schema( $this->schema ); 316 322 } 317 323 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r45705 r45811 1871 1871 */ 1872 1872 public function get_item_schema() { 1873 if ( $this->schema ) { 1874 return $this->add_additional_fields_schema( $this->schema ); 1875 } 1873 1876 1874 1877 $schema = array( … … 2230 2233 } 2231 2234 2232 return $this->add_additional_fields_schema( $schema ); 2235 $this->schema = $schema; 2236 return $this->add_additional_fields_schema( $this->schema ); 2233 2237 } 2234 2238 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
r45267 r45811 607 607 */ 608 608 public function get_item_schema() { 609 if ( $this->schema ) { 610 return $this->add_additional_fields_schema( $this->schema ); 611 } 612 609 613 $schema = array( 610 614 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 683 687 } 684 688 685 return $this->add_additional_fields_schema( $schema ); 689 $this->schema = $schema; 690 return $this->add_additional_fields_schema( $this->schema ); 686 691 } 687 692 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
r45267 r45811 212 212 */ 213 213 public function get_item_schema() { 214 if ( $this->schema ) { 215 return $this->add_additional_fields_schema( $this->schema ); 216 } 217 214 218 $types = array(); 215 219 $subtypes = array(); … … 263 267 ); 264 268 265 return $this->add_additional_fields_schema( $schema ); 269 $this->schema = $schema; 270 return $this->add_additional_fields_schema( $this->schema ); 266 271 } 267 272 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
r43571 r45811 271 271 */ 272 272 public function get_item_schema() { 273 if ( $this->schema ) { 274 return $this->add_additional_fields_schema( $this->schema ); 275 } 276 273 277 $options = $this->get_registered_options(); 274 278 … … 287 291 } 288 292 289 return $this->add_additional_fields_schema( $schema ); 293 $this->schema = $schema; 294 return $this->add_additional_fields_schema( $this->schema ); 290 295 } 291 296 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php
r43571 r45811 277 277 */ 278 278 public function get_item_schema() { 279 if ( $this->schema ) { 280 return $this->add_additional_fields_schema( $this->schema ); 281 } 282 279 283 $schema = array( 280 284 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 374 378 ), 375 379 ); 376 return $this->add_additional_fields_schema( $schema ); 380 381 $this->schema = $schema; 382 return $this->add_additional_fields_schema( $this->schema ); 377 383 } 378 384 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
r45723 r45811 857 857 */ 858 858 public function get_item_schema() { 859 if ( $this->schema ) { 860 return $this->add_additional_fields_schema( $this->schema ); 861 } 862 859 863 $schema = array( 860 864 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 925 929 $schema['properties']['meta'] = $this->meta->get_field_schema(); 926 930 927 return $this->add_additional_fields_schema( $schema ); 931 $this->schema = $schema; 932 return $this->add_additional_fields_schema( $this->schema ); 928 933 } 929 934 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
r44138 r45811 148 148 */ 149 149 public function get_item_schema() { 150 if ( $this->schema ) { 151 return $this->add_additional_fields_schema( $this->schema ); 152 } 153 150 154 $schema = array( 151 155 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 178 182 ); 179 183 180 return $this->add_additional_fields_schema( $schema ); 184 $this->schema = $schema; 185 return $this->add_additional_fields_schema( $this->schema ); 181 186 } 182 187 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
r45632 r45811 1179 1179 */ 1180 1180 public function get_item_schema() { 1181 if ( $this->schema ) { 1182 return $this->add_additional_fields_schema( $this->schema ); 1183 } 1184 1181 1185 $schema = array( 1182 1186 '$schema' => 'http://json-schema.org/draft-04/schema#', … … 1335 1339 $schema['properties']['meta'] = $this->meta->get_field_schema(); 1336 1340 1337 return $this->add_additional_fields_schema( $schema ); 1341 $this->schema = $schema; 1342 return $this->add_additional_fields_schema( $this->schema ); 1338 1343 } 1339 1344 -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r45607 r45811 3920 3920 remove_post_type_support( 'post', 'author' ); 3921 3921 3922 // Re-initialize the controller to cache-bust schemas from prior test runs. 3923 $GLOBALS['wp_rest_server']->override_by_default = true; 3924 $controller = new WP_REST_Posts_Controller( 'post' ); 3925 $controller->register_routes(); 3926 $GLOBALS['wp_rest_server']->override_by_default = false; 3927 3922 3928 $response = rest_get_server()->dispatch( new WP_REST_Request( 'OPTIONS', '/wp/v2/posts' ) ); 3923 3929 $data = $response->get_data(); -
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r45424 r45811 2523 2523 public function test_get_item_schema_show_avatar() { 2524 2524 update_option( 'show_avatars', false ); 2525 2526 // Re-initialize the controller to cache-bust schemas from prior test runs. 2527 $GLOBALS['wp_rest_server']->override_by_default = true; 2528 $controller = new WP_REST_Users_Controller(); 2529 $controller->register_routes(); 2530 $GLOBALS['wp_rest_server']->override_by_default = false; 2531 2525 2532 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/users' ); 2526 2533 $response = rest_get_server()->dispatch( $request );
Note: See TracChangeset
for help on using the changeset viewer.