diff --git a/.changeset/place-order-errors-nullable.md b/.changeset/place-order-errors-nullable.md new file mode 100644 index 0000000000..444124f64f --- /dev/null +++ b/.changeset/place-order-errors-nullable.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/magento-graphql': patch +--- + +Relax `PlaceOrderOutput.errors` to nullable in the unified schema. Magento 2.4.9 / MageOS 3.2.0 changed the field from `[PlaceOrderError]!` to `[PlaceOrderError]` and returns `null` when the order is placed successfully, so a storefront configured with `magentoVersion` < 249 talking to a 2.4.9 backend failed every successful order with `Cannot return null for non-nullable field PlaceOrderOutput.errors.` diff --git a/packages/magento-graphql/schema-249/PlaceOrderOutput.graphqls b/packages/magento-graphql/schema-249/PlaceOrderOutput.graphqls new file mode 100644 index 0000000000..150e0dca41 --- /dev/null +++ b/packages/magento-graphql/schema-249/PlaceOrderOutput.graphqls @@ -0,0 +1,12 @@ +# Magento 2.4.9 (and MageOS 3.2.0) relaxed `PlaceOrderOutput.errors` from +# `[PlaceOrderError]!` to `[PlaceOrderError]` and now returns `null` when the +# order is placed successfully. The unified schema must use the nullable +# variant, otherwise the mesh throws "Cannot return null for non-nullable field +# PlaceOrderOutput.errors." on every successful placeOrder once the backend +# runs 2.4.9, while a 2.4.8 backend still satisfies the relaxed contract. +type PlaceOrderOutput { + """ + An array of place order errors. Returns null on success since Magento 2.4.9. + """ + errors: [PlaceOrderError] +}