[wp-trac] [WordPress Trac] #39561: REST API JavaScript client: Correct name route discovery for custom namespaces

WordPress Trac noreply at wordpress.org
Mon Feb 20 14:35:40 UTC 2017


#39561: REST API JavaScript client: Correct name route discovery for custom
namespaces
------------------------------------------+------------------------------
 Reporter:  adamsilverstein               |       Owner:  adamsilverstein
     Type:  defect (bug)                  |      Status:  reopened
 Priority:  normal                        |   Milestone:  4.7.3
Component:  REST API                      |     Version:  4.7
 Severity:  normal                        |  Resolution:
 Keywords:  fixed-major needs-unit-tests  |     Focuses:  javascript
------------------------------------------+------------------------------

Comment (by adamsilverstein):

 In [attachment:39561.4.diff] :
 * check for each route instead of a strict equality comparison on the
 schema. address a potential failure if plugins or themes try running tests
 with additional routes present, as @rachelbaker
 [https://wordpress.slack.com/archives/core-restapi/p1487480164004508
 pointed out in slack].
 * add a fixture for the custom endpoints created by the
 [https://github.com/xwp/wp-js-widgets wp-js-widgets plugin] - this is a
 good test case for the route discovery/class naming code.
 * add an additional test block, verifying the schema parsing correctly
 generates proper class names for each model and collection route.

 Note: the tests surfaced one issue with the parsing - underscores are
 being left untouched - hence the class name `WidgetsTag_cloud`, this
 should probably be auto-transformed to `WidgetsTagCloud` similar to
 handling of `-`. I will address that in a separate ticket.

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


More information about the wp-trac mailing list