Make WordPress Core


Ignore:
Timestamp:
10/01/2020 02:47:08 AM (4 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Support the patternProperties JSON Schema keyword.

Props yakimun.
Fixes #51024.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api.php

    r48937 r49082  
    12851285                array( 'additional' => array( 'a' => '1' ) ),
    12861286            ),
     1287            'pattern properties'                  => array(
     1288                array(
     1289                    '$schema'              => 'http://json-schema.org/draft-04/schema#',
     1290                    'type'                 => 'object',
     1291                    'properties'           => array(
     1292                        'a' => array(
     1293                            'type'    => 'string',
     1294                            'context' => array( 'view', 'edit' ),
     1295                        ),
     1296                    ),
     1297                    'patternProperties'    => array(
     1298                        '[0-9]' => array(
     1299                            'type'    => 'string',
     1300                            'context' => array( 'view', 'edit' ),
     1301                        ),
     1302                        'c.*'   => array(
     1303                            'type'    => 'string',
     1304                            'context' => array( 'edit' ),
     1305                        ),
     1306                    ),
     1307                    'additionalProperties' => array(
     1308                        'type'    => 'string',
     1309                        'context' => array( 'edit' ),
     1310                    ),
     1311                ),
     1312                array(
     1313                    'a'  => '1',
     1314                    'b'  => '2',
     1315                    '0'  => '3',
     1316                    'ca' => '4',
     1317                ),
     1318                array(
     1319                    'a' => '1',
     1320                    '0' => '3',
     1321                ),
     1322            ),
    12871323            'multiple types object'               => array(
    12881324                array(
Note: See TracChangeset for help on using the changeset viewer.