[wp-trac] [WordPress Trac] #48785: REST API: WP_REST_Controller::get_public_item_schema() assumes that the schema has properties.

WordPress Trac noreply at wordpress.org
Sun Nov 24 22:42:08 UTC 2019


#48785: REST API: WP_REST_Controller::get_public_item_schema() assumes that the
schema has properties.
-------------------------+-------------------------------------------------
 Reporter:  pento        |      Owner:  (none)
     Type:  defect       |     Status:  new
  (bug)                  |
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:  4.7
 Severity:  normal       |   Keywords:  needs-patch needs-unit-tests good-
                         |  first-bug
  Focuses:               |  PR Number:
-------------------------+-------------------------------------------------
 My understanding of JSON Schema is that the base type doesn't necessarily
 need to be an object, it can be any type, so it's possible to define an
 endpoint that returns a string:

 {{{#!php
 array(
         '$schema'     => 'http://json-schema.org/draft-04/schema#',
         'title'       => 'foo',
         'type'        => 'string',
         'description' => __( 'This is my magical endpoint that just
 returns a string.' ),
 );
 }}}

 Other methods on `WP_REST_Controller` seem to check that `properties` is
 defined on the schema, but `::get_public_item_schema()` doesn't.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48785>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list