[wp-trac] [WordPress Trac] #41056: WP-API JS Client: Settings is incorrectly registered as a collection

WordPress Trac noreply at wordpress.org
Thu Jun 15 08:15:13 UTC 2017


#41056: WP-API JS Client: Settings is incorrectly registered as a collection
----------------------------------+-----------------------------
 Reporter:  adamsilverstein       |      Owner:
     Type:  defect (bug)          |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  General               |    Version:
 Severity:  normal                |   Keywords:  needs-patch
  Focuses:  javascript, rest-api  |
----------------------------------+-----------------------------
 Similar to the `me` endpoint, `/wp/v2/settings` is a model, not a
 collection. This is incorrectly detected due to the JS code assuming
 anything not ending with a regex is a collection, which is not true.

 Potentially, we need to change the API to better expose what is and isn't
 a collection to the JS. The schema in the returned OPTIONS currently
 indicates that the response is an object, whereas it's actually a list of
 objects. If we change this, we need to look carefully at how we retrofit
 this, as changing it may break compatibility.

 We should discuss how best to expose collections vs models via the API.
 Changing the schema is the best way, I think. See [https://github.com/WP-
 API/proposals/issues/2 WP-API/proposals#2] for that discussion.

 In the meantime, we should special-case `/settings` as well.

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


More information about the wp-trac mailing list