REST API: Support the patternProperties JSON Schema keyword.

Props yakimun.
Fixes #51024.


git-svn-id: https://develop.svn.wordpress.org/trunk@49082 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Timothy Jacobs
2020-10-01 02:47:08 +00:00
parent 062db8120d
commit f60aa51988
6 changed files with 325 additions and 11 deletions

View File

@@ -1284,6 +1284,42 @@ class Tests_REST_API extends WP_UnitTestCase {
),
array( 'additional' => array( 'a' => '1' ) ),
),
'pattern properties' => array(
array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'type' => 'object',
'properties' => array(
'a' => array(
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
),
'patternProperties' => array(
'[0-9]' => array(
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'c.*' => array(
'type' => 'string',
'context' => array( 'edit' ),
),
),
'additionalProperties' => array(
'type' => 'string',
'context' => array( 'edit' ),
),
),
array(
'a' => '1',
'b' => '2',
'0' => '3',
'ca' => '4',
),
array(
'a' => '1',
'0' => '3',
),
),
'multiple types object' => array(
array(
'$schema' => 'http://json-schema.org/draft-04/schema#',