[wp-trac] [WordPress Trac] #44287: REST API: Declare user capability to perform actions using JSON Hyper Schema `targetSchema`

WordPress Trac noreply at wordpress.org
Tue Jun 12 17:21:59 UTC 2018


#44287: REST API: Declare user capability to perform actions using JSON Hyper
Schema `targetSchema`
--------------------------------------+-----------------------
 Reporter:  danielbachhuber           |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  4.9.8
Component:  Role/Capability           |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+-----------------------
Changes (by TimothyBlynJacobs):

 * keywords:  needs-patch needs-unit-tests => has-patch has-unit-tests


Comment:

 First pass at a patch.

 1) I did some adjusting to the attachments controller to resuse the links
 definition from the parent response. That way we don't have to repeat
 ourselves for adding the action links. As far as I can tell, the `$post`
 var isn't adjusted during that method to the links generated should always
 be the same.

 2) I wasn't sure of the best way to structure the unit tests. For the most
 part they are all just in the posts controller tests with some small unit
 tests in the attachments controller since it has a separate
 prepare_item_for_response.

 3) I made some minor changes to the text from the Gutenberg version,
 adding the taxonomy name in the description strings. This matches the
 description for the main schema document.

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


More information about the wp-trac mailing list