[wp-trac] [WordPress Trac] #56368: Unable to use enum with array data type - REST API
WordPress Trac
noreply at wordpress.org
Fri Aug 12 08:16:14 UTC 2022
#56368: Unable to use enum with array data type - REST API
-------------------------+-----------------------------
Reporter: picocodes | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Keywords:
Focuses: rest-api |
-------------------------+-----------------------------
I would like to be able to specify enums when creating a REST schema
property that accepts an array of values.
**For example:**
{{{#!php
<?PHP
$query_schema['orderby'] = array(
'description' => __( 'Sort collection by object attribute.'
),
'type' => array( 'string', 'array' ),
'default' => 'id',
'items' => array(
'type' => 'string',
),
'enum' => array( 'id', 'title', 'date', 'include' ),
'validate_callback' => 'rest_validate_request_arg',
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56368>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list