[wp-trac] [WordPress Trac] #51020: The public route args schema drops valid JSON Schema properties (was: minItems/maxItems not shown in argument schema)

WordPress Trac noreply at wordpress.org
Sat Aug 15 13:05:02 UTC 2020


#51020: The public route args schema drops valid JSON Schema properties
--------------------------------------+-----------------------
 Reporter:  raubvogel                 |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  5.6
Component:  REST API                  |     Version:  4.7
 Severity:  normal                    |  Resolution:
 Keywords:  dev-feedback needs-patch  |     Focuses:  rest-api
--------------------------------------+-----------------------
Changes (by TimothyBlynJacobs):

 * version:  trunk => 4.7
 * milestone:  Awaiting Review => 5.6


Comment:

 Thanks for the ticket @raubvogel!

 This is because the REST Server only adds a small number of the JSON
 Schema properties to the args: https://github.com/WordPress/wordpress-
 develop/blob/8c378606ab14c2e426c719de231bf63b05d45420/src/wp-includes
 /rest-api/class-wp-rest-server.php#L1300

 The full list of what should be allowed is in
 `WP_REST_Controller::get_endpoint_args_for_item_schema()`:
 https://github.com/WordPress/wordpress-
 develop/blob/8c378606ab14c2e426c719de231bf63b05d45420/src/wp-includes
 /rest-api/endpoints/class-wp-rest-controller.php#L632

 We should probably update `WP_REST_Server::get_data_for_route()` to
 include that same list of valid property names.

 Do you want to work on a patch for this?

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


More information about the wp-trac mailing list