magento / architecture

A place where Magento architectural discussions happen
275 stars 154 forks source link

PWA-1611: Adding the ability to report partial successes #505

Closed pdohogne-magento closed 2 years ago

pdohogne-magento commented 3 years ago

PWA-1611: Adding the ability to report partial successes on batch operations in Negotiable Quote

Problem

Some batch mutations in the Negotiable Quote module can have partial successes where some of the items succeed and some fail. This needs to be reported in a usable way.

Solution

Add a tri-state result status field to these operations with a SUCCESS, FAILURE, and PARTIAL_SUCCESS enum, and include an array result field that reports either a success or a typed failure for each item specified in the batch.

Requested Reviewers

pdohogne-magento commented 3 years ago

Here's the article where this strategy for handling error results came from explaining why it's a helpful approach: https://blog.logrocket.com/handling-graphql-errors-like-a-champ-with-unions-and-interfaces/

pdohogne-magento commented 3 years ago

@aniham @jimbo @eug123 @cpartica @cspruiell @amolina-magento @keharper @abrhim @prabhuram93

This proposal has been updated according to continued conversation. Please re-review when available.

The intent is for this to be the pattern for error reporting in new additions to the schema going forward.

keharper commented 3 years ago

Re-approved