#48823 closed enhancement (fixed)
Collect all REST API meta errors at once
Reported by: | TimothyBlynJacobs | Owned by: | spacedmonkey |
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | has-patch has-unit-tests commit needs-dev-note |
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 (31)
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
4 years ago
#3
@
4 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.
4 years ago
#4
- Keywords has-patch has-unit-tests added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/48823
This ticket was mentioned in Slack in #core-restapi by hellofromtonya. View the logs.
4 years ago
#6
@
4 years ago
Per Timothy, this ticket is blocked by #46191.
This ticket was mentioned in Slack in #core by chaion07. View the logs.
4 years ago
#9
@
4 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
@
22 months ago
This change looks good @TimothyBlynJacobs . I think we can get this in the next release.
This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.
18 months ago
#12
@
18 months ago
- Milestone changed from Future Release to 6.4
- Owner set to spacedmonkey
- Status changed from new to assigned
#13
@
16 months ago
The patch is still applicable, no rebase is needed. @TimothyBlynJacobs and @spacedmonkey what is the next step, testing? If so, we need testing info.
This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.
15 months ago
This ticket was mentioned in Slack in #core by oglekler. View the logs.
15 months ago
#18
@
15 months ago
In discussing with @azaozz, we both have concerns of potential regressions and/or unexpected behaviors due to the code not bailing out immediately with an error, i.e. being allowed to continue processing.
Given how important the REST API is, we're thinking this one is a good early
candidate. Rather than committing it right before 6.4 Beta 1, instead commit it when 6.5 Alpha opens.
early
would give it a long soak time to potentially discover if there are indeed regressions or unexpected behaviors. For example, the Gutenberg plugin uses the REST API. It's a good candidate to flush out if there are any unknown issues.
@azaozz noted:
Yea, thinking it may be a bit risky, and testing it and confirming it doesn't bring a regression would be great
@TimothyBlynJacobs @spacedmonkey what do you both think? Are there risks?
#22
@
11 months ago
@hellofromTonya I am not worried about this change. Multiple keys could be updated at once before. It could have error mid way through the process. But after this change, values will be updated to the key that are getting valid values and how all errored keys. This is much cleaner and predictable behaviour.
I want to get this committed early. Are you happy for me to commit?
#24
@
10 months ago
- Keywords commit added
Sorry for my delay in responding @spacedmonkey. Would have preferred this one to be committed much earlier in the Alpha cycle. That said, given there's consensus of little to no risks, seems okay to commit. Then through Beta and RC, can be monitored if there is any feedback.
I think this is fine to commit now.
Marking for commit per @TimothyBlynJacobs feedback comment:23.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
10 months ago
#26
@
10 months ago
- Keywords needs-testing-info removed
@spacedmonkey are you available to commit this patch in the next few hours, before beta 1? Thanks!
This ticket was mentioned in PR #6099 on WordPress/wordpress-develop by @spacedmonkey.
10 months ago
#27
Trac ticket: https://core.trac.wordpress.org/ticket/48823
@spacedmonkey commented on PR #6099:
10 months ago
#30
Committed.
@spacedmonkey commented on PR #877:
10 months ago
#31
Committed
Going to try taking a look at this for 5.7 now that we can merge
WP_Error
objects and keep additional data.