Make WordPress Core


Ignore:
Timestamp:
10/15/2021 02:03:38 AM (5 years ago)
Author:
rachelbaker
Message:

REST API: Add text-field and textarea-field as available schema formats for string sanitization.

Props ocean90, TimothyBlynJacobs.
Fixes #49960.

File:
1 edited

Legend:

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

    r49246 r51908  
    3737                        'type'       => 'object',
    3838                        'properties' => array(
    39                                 'somestring'     => array(
     39                                'somestring'        => array(
    4040                                        'type'        => 'string',
    4141                                        'description' => 'A pretty string.',
    … …  
    4545                                        'context'     => array( 'view' ),
    4646                                ),
    47                                 'someinteger'    => array(
     47                                'someinteger'       => array(
    4848                                        'type'             => 'integer',
    4949                                        'multipleOf'       => 10,
    … …  
    5454                                        'context'          => array( 'view' ),
    5555                                ),
    56                                 'someboolean'    => array(
     56                                'someboolean'       => array(
    5757                                        'type'    => 'boolean',
    5858                                        'context' => array( 'view' ),
    5959                                ),
    60                                 'someurl'        => array(
     60                                'someurl'           => array(
    6161                                        'type'    => 'string',
    6262                                        'format'  => 'uri',
    6363                                        'context' => array( 'view' ),
    6464                                ),
    65                                 'somedate'       => array(
     65                                'somedate'          => array(
    6666                                        'type'    => 'string',
    6767                                        'format'  => 'date-time',
    6868                                        'context' => array( 'view' ),
    6969                                ),
    70                                 'someemail'      => array(
     70                                'someemail'         => array(
    7171                                        'type'    => 'string',
    7272                                        'format'  => 'email',
    7373                                        'context' => array( 'view' ),
    7474                                ),
    75                                 'somehex'        => array(
     75                                'somehex'           => array(
    7676                                        'type'    => 'string',
    7777                                        'format'  => 'hex-color',
    7878                                        'context' => array( 'view' ),
    7979                                ),
    80                                 'someuuid'       => array(
     80                                'someuuid'          => array(
    8181                                        'type'    => 'string',
    8282                                        'format'  => 'uuid',
    8383                                        'context' => array( 'view' ),
    8484                                ),
    85                                 'someenum'       => array(
     85                                'sometextfield'     => array(
     86                                        'type'    => 'string',
     87                                        'format'  => 'text-field',
     88                                        'context' => array( 'view' ),
     89                                ),
     90                                'sometextareafield' => array(
     91                                        'type'    => 'string',
     92                                        'format'  => 'textarea-field',
     93                                        'context' => array( 'view' ),
     94                                ),
     95                                'someenum'          => array(
    8696                                        'type'    => 'string',
    8797                                        'enum'    => array( 'a', 'b', 'c' ),
    8898                                        'context' => array( 'view' ),
    8999                                ),
    90                                 'someargoptions' => array(
     100                                'someargoptions'    => array(
    91101                                        'type'        => 'integer',
    92102                                        'required'    => true,
    … …  
    96106                                        ),
    97107                                ),
    98                                 'somedefault'    => array(
     108                                'somedefault'       => array(
    99109                                        'type'    => 'string',
    100110                                        'enum'    => array( 'a', 'b', 'c' ),
    … …  
    102112                                        'default' => 'a',
    103113                                ),
    104                                 'somearray'      => array(
     114                                'somearray'         => array(
    105115                                        'type'        => 'array',
    106116                                        'items'       => array(
    … …  
    112122                                        'context'     => array( 'view' ),
    113123                                ),
    114                                 'someobject'     => array(
     124                                'someobject'        => array(
    115125                                        'type'                 => 'object',
    116126                                        'additionalProperties' => array(
Note: See TracChangeset for help on using the changeset viewer.