#50876 closed enhancement (fixed)
REST API: Extract get_endpoint_args_for_item_schema to standalone function
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.6 | Priority: | normal |
| Severity: | normal | Version: | 4.7 |
| Component: | REST API | Keywords: | good-first-bug has-patch has-unit-tests |
| Focuses: | Cc: |
Description
The WP_REST_Controller:get_endpoint_args_for_item_schema() method allows converting a schema to an args format for WP_REST_Request. This is a helpful function for whenever you want to apply this kind of conversion, but since it is a part of the WP_REST_Controller class, and doesn't accept the schema to transform directly, doing this conversion is tricky.
I think it'd be helpful to extract this to a standalone rest_get_endpoint_args_for_schema( $schema, $method ) function that the existing method in WP_REST_Controller can then call.
Change History (5)
This ticket was mentioned in PR #492 on WordPress/wordpress-develop by pentatonicfunk.
5 years ago
#1
- Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
#2
@
5 years ago
Couldn't agree more, exposing this function will give more benefits to developers.
I've create initial PR.
#3
@
5 years ago
- Owner set to TimothyBlynJacobs
- Resolution set to fixed
- Status changed from new to closed
In 48951:
TimothyBJacobs commented on PR #492:
5 years ago
#5
Merged in 84d524e. Thanks again for the patch!
get_endpoint_args_for_item_schemato standalonerest_get_endpoint_args_for_schemafunctionrest-controller.php, change focus torest_get_endpoint_args_for_schemahttps://core.trac.wordpress.org/ticket/50876