Skip to content

GraphQL inventorySetQuantitiesInput compareQuantity null does not skip compareAndSwap #1253

Description

@halcyon1234

Expectation: setting InventoryQuantityInput.changeFromQuantity to null OR not setting a value at all (leaving it null by default) will skip CAS check.

Happening: both cases does not skip the CAS check.

Details:

I'm sending the inventorySetQuantities mutation below (replace idempotent guid as needed) using a InventorySetQuantitiesInput object for input. I've tried both:

  • Not setting InventorySetQuantitiesInput.quantities.changeFromQuantities (default is null)
  • EXPLICITLY setting InventorySetQuantitiesInput.quantities.changeFromQuantities = null

The documentation for InventoryQuantityInput says "Explicitly passing in null to this field opts out of the quantity comparison check."

Which seems to conflict with the rest of the documentation
"/// Explicitly passing in any value (be it null or an integer) to changeFromQuantity will cause the values
/// passed into the compareQuantity and InventorySetQuantitiesInput.ignoreCompareQuantity fields to be
/// ignored in favour of the changeFromQuantity value."

In both cases, rather than skipping CAS, the call fails with:

"{"The compareQuantity argument must be given to each quantity or ignored using ignoreCompareQuantity."}"

mutation InventorySet($input: InventorySetQuantitiesInput!) { inventorySetQuantities(input: $input) @idempotent(key: "f1abaa88-ad7b-4643-ac06-804e7b68bdae}}") { inventoryAdjustmentGroup {createdAt reason referenceDocumentUri changes {name delta}} userErrors {field message} }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions