Make WordPress Core

Opened 4 years ago

Last modified 3 months ago

#48823 new enhancement

Collect all REST API meta errors at once

Reported by: timothyblynjacobs's profile TimothyBlynJacobs Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Currently, when updating meta, we return immediately after encountering a WP_Error. If there are issues with multiple meta keys, you have to correct each value and send a new request one at a time. I think it'd be ideal if we could process all the meta fields and then return all the errors that are encountered at once.

WP_Error supports multiple error messages with the same code, but it does not support multiple bits of error_data for the same code. This would be a problem for the errors that include the affected meta key in the error data. Right now, the REST API duplicates this data for each error with the same code ( WP_REST_Server::error_to_response ). I think we'd need to find a way to retain the error message and data correlation in WP_Error.

Change History (10)

#1 @TimothyBlynJacobs
3 years ago

  • Milestone changed from Awaiting Review to 5.7

Going to try taking a look at this for 5.7 now that we can merge WP_Error objects and keep additional data.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


2 years ago

#3 @hellofromTonya
2 years ago

  • Keywords needs-patch added

Per Timothy in today's core scrub:

Needs patch probably. Planning on working on it this week

This ticket was mentioned in PR #877 on WordPress/wordpress-develop by TimothyBJacobs.


2 years ago
#4

  • Keywords has-patch has-unit-tests added; needs-patch removed

This ticket was mentioned in Slack in #core-restapi by hellofromtonya. View the logs.


2 years ago

#6 @hellofromTonya
2 years ago

Per Timothy, this ticket is blocked by #46191.

#7 @TimothyBlynJacobs
2 years ago

  • Milestone changed from 5.7 to 5.8

Punting as multi error data isn't solved yet.

This ticket was mentioned in Slack in #core by chaion07. View the logs.


2 years ago

#9 @desrosj
2 years ago

  • Milestone changed from 5.8 to Future Release

This one has not seen any activity during the 5.8 cycle. I'm going to punt to Future Release to prevent repeated punting. But it can be moved back to a numbered milestone at any time.

#10 @spacedmonkey
3 months ago

This change looks good @TimothyBlynJacobs . I think we can get this in the next release.

Note: See TracTickets for help on using tickets.