#50876 closed enhancement (fixed)
REST API: Extract get_endpoint_args_for_item_schema to standalone function
| Reported by: | TimothyBlynJacobs | Owned by: | TimothyBlynJacobs |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.6 |
| Component: | REST API | Version: | 4.7 |
| Severity: | normal | Keywords: | good-first-bug has-patch has-unit-tests |
| Cc: | Focuses: |
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.
6 years ago
#1
- Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
#2
@
6 years ago
Couldn't agree more, exposing this function will give more benefits to developers.
I've create initial PR.
TimothyBJacobs commented on PR #492:
6 years ago
#5
Merged in 84d524e. Thanks again for the patch!
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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