[wp-trac] [WordPress Trac] #34729: Use short CURIEs instead of full URIs

WordPress Trac noreply at wordpress.org
Mon Mar 14 17:15:24 UTC 2016


#34729: Use short CURIEs instead of full URIs
----------------------------+-----------------------
 Reporter:  rmccue          |       Owner:  joehoyle
     Type:  task (blessed)  |      Status:  reopened
 Priority:  normal          |   Milestone:  4.5
Component:  REST API        |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:
----------------------------+-----------------------

Comment (by joehoyle):

 Ok, I took another stab a the approach. I think the above is a red herring
 (though I think we should laxen the regex either way.

 Most of the issue stem from the fact that we generate the curies at the
 server level, this means things like collection resources get curies
 applied at a difference stage to top level ones, which screws up our unit
 tests.

 Instead, I've taken the approach of curies being abstracted in the
 WP_REST_Response class via get_links, so virtually any "exposed" link,
 even internally will be "curie-ified". This makes things a lot simpler, as
 you don't need to know whether a response has come in via the Server's
 `serve_request` method, or via dispatch.

 For backwards compatibility, this might present a challenge however,
 because we can't shim the `get_links` method of the WP_REST_Response class
 for WordPress 4.4. That might not be a huge issue, and it's possible we
 could fudge it somehow at the server level (similar to what
 @danielbachhuber tried to do in https://github.com/WP-API/WP-
 API/pull/2295.

 _Ideally_ we could subclass WP_REST_Response in the plugin for backwards
 compat, but we don't support filtering the Response class so that wouldn't
 be possible I think.

 Looking to get this wrapped up today, will chat with @rmccue when he is
 online.

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


More information about the wp-trac mailing list