[wp-trac] [WordPress Trac] #46191: REST API parameter validation should handle multiple error messages/codes.
WordPress Trac
noreply at wordpress.org
Tue Feb 2 17:26:22 UTC 2021
#46191: REST API parameter validation should handle multiple error messages/codes.
--------------------------------------+--------------------------------
Reporter: tmfespresso | Owner: TimothyBlynJacobs
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.7
Component: REST API | Version: 4.4
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests | Focuses: rest-api
--------------------------------------+--------------------------------
Changes (by TimothyBlynJacobs):
* owner: (none) => TimothyBlynJacobs
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"50150" 50150]:
{{{
#!CommitTicketReference repository="" revision="50150"
REST API: Return detailed error information from request validation.
Previously, only the first error message for each parameter was made
available. Now, all error messages for a parameter are concatenated.
Additionally, the detailed error for each parameter is made available in a
new `details` section of the validation error. Each error is formatted
following the standard REST API error formatting.
The `WP_REST_Server::error_to_response` method has been abstracted out
into a standalone function `rest_convert_error_to_response` to allow for
reuse by `WP_REST_Request`. The formatted errors now also contain an
`additional_data` property which contains the additional error data
provided by `WP_Error::get_all_error_data`.
Props dlh, xkon, TimothyBlynJacobs.
Fixes #46191.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46191#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list