[wp-trac] [WordPress Trac] #48818: REST API does not check nested required properties

WordPress Trac noreply at wordpress.org
Wed Jan 1 16:53:28 UTC 2020


#48818: REST API does not check nested required properties
-------------------------------+------------------------------
 Reporter:  TimothyBlynJacobs  |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  REST API           |     Version:  4.9
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by circuitbit):

 Just thought it would be important to mention that according to JSON-
 Schema spec it's also possible to have a `required` field as an array of
 strings containing the properties which are required for that object, so
 that would be, sort of, expected.

 {{{#!php
 $schema = array(
    'type'       => 'object',
    'properties' => array(
       'first_name' => array( 'type' => 'string' ),
       'last_name'  => array( 'type' => 'string' ),
       'email'      => array( 'type' => 'string' ),
    ),
    'required'   => array( 'first_name', 'last_name', 'email' ),
 );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48818#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list