diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php index 0d1e85cbf1..44880aaec2 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php @@ -645,6 +645,7 @@ abstract class WP_REST_Controller { 'pattern', 'minItems', 'maxItems', + 'uniqueItems', ); foreach ( $schema_properties as $field_id => $params ) { diff --git a/tests/phpunit/tests/rest-api/rest-controller.php b/tests/phpunit/tests/rest-api/rest-controller.php index b04158b037..b68300e270 100644 --- a/tests/phpunit/tests/rest-api/rest-controller.php +++ b/tests/phpunit/tests/rest-api/rest-controller.php @@ -265,7 +265,7 @@ class WP_Test_REST_Controller extends WP_Test_REST_TestCase { $this->assertArrayHasKey( 'items', $args['somearray'] ); - foreach ( array( 'minItems', 'maxItems' ) as $property ) { + foreach ( array( 'minItems', 'maxItems', 'uniqueItems' ) as $property ) { $this->assertArrayHasKey( $property, $args['somearray'] ); } diff --git a/tests/phpunit/tests/rest-api/rest-test-controller.php b/tests/phpunit/tests/rest-api/rest-test-controller.php index e3a82586bc..35175f35b1 100644 --- a/tests/phpunit/tests/rest-api/rest-test-controller.php +++ b/tests/phpunit/tests/rest-api/rest-test-controller.php @@ -101,13 +101,14 @@ class WP_REST_Test_Controller extends WP_REST_Controller { 'default' => 'a', ), 'somearray' => array( - 'type' => 'array', - 'items' => array( + 'type' => 'array', + 'items' => array( 'type' => 'string', ), - 'minItems' => 1, - 'maxItems' => 10, - 'context' => array( 'view' ), + 'minItems' => 1, + 'maxItems' => 10, + 'uniqueItems' => true, + 'context' => array( 'view' ), ), 'someobject' => array( 'type' => 'object',