WordPress/wp-includes/rest-api
TimothyBlynJacobs f43ca27db9 REST API: Support a route-level validation callback.
Most request data is validated on a per-parameter basis. Often, however, additional validation is needed that operates on the entire request object. Currently, this is done in the route callback and often in the `prepare_item_for_database` method specifically.

#50244 aims to introduce batch processing in the REST API. An important feature is the ability to enforce that all requests have valid data before executing the route callbacks in "pre-validate" mode.

This patch introduces support for calling a `validate_callback` after all parameter validation has succeeded. That allows moving more validation outside of the route callback and into `WP_REST_Request` which will improve "pre-validate" support.

Props TimothyBlynJacobs, zieladam.
Fixes #51255.
See #50244.



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


git-svn-id: http://core.svn.wordpress.org/trunk@48707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-05 18:09:06 +00:00
..
endpoints REST API: In `WP_REST_Block_Directory_Controller::get_items()`, make sure the blocks data for a plugin is not empty before proceeding. 2020-08-22 01:54:11 +00:00
fields Docs: Synchronize and correct documentation for various metadata functions and filters. 2020-07-09 11:26:07 +00:00
search REST API: Use new `rest_get_route_for_post()` in the post search handler. 2020-07-07 15:31:02 +00:00
class-wp-rest-request.php REST API: Support a route-level validation callback. 2020-09-05 18:09:06 +00:00
class-wp-rest-response.php Docs: Improve inline comments per the documentation standards. 2020-01-29 00:45:18 +00:00
class-wp-rest-server.php Docs: Further corrections and improvements to various inline docblocks. 2020-07-23 07:39:02 +00:00