REST API: Add support for arrays in schema validation and sanitization.

By allowing more fine-grained validation and sanitisation of endpoint args, we can ensure the correct data is being passed to endpoints.

This can easily be extended to support new data types, such as CSV fields or objects.

Props joehoyle, rachelbaker, pento.
Fixes #38531.



git-svn-id: https://develop.svn.wordpress.org/trunk@39046 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2016-10-31 01:47:36 +00:00
parent 5b4f2b3021
commit a86bc6f565
6 changed files with 288 additions and 103 deletions

View File

@@ -1006,6 +1006,9 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
'roles' => array(
'description' => __( 'Roles assigned to the resource.' ),
'type' => 'array',
'items' => array(
'type' => 'string',
),
'context' => array( 'edit' ),
),
'password' => array(