magento2: REST API multiselect attribute BC break between 2.1.8 and 2.3.0

Preconditions (*)

  1. Magento 2.4-develop

Steps to reproduce (*)

  1. Have a multiselect attribute
  2. Update the product data through the REST API and pass an array of IDs as a value for this multiselect attribute

Expected result (*)

  1. Attribute is updated (as it worked in 2.1.8)

Actual result (*)

  1. Error message is returned:
{
    "message": "Error occurred during \"custom_attributes\" processing. Attribute \"equipment\" has invalid value. The \"array\" value's type is invalid. The \"string\" type was expected. Verify and try again.",
    "trace": null
}

Workaround

Implode the ids and send them as a string. But it makes your code incompatible with Magento 2.1.8 as it expects an array of ids.

I guess that it is some kind of BC break, because Magento 2.1.8 works in a completely opposite way - it requires an array of IDs and rejects string with a message: {"message":"Error occurred during \"custom_attributes\" processing. Attribute \"equipment\" has invalid value. Invalid type for value: \"string\". Expected Type: \"string[]\"."}

Related issue: #6120

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 3
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

✅ Confirmed by @engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-98363, MAGETWO-98364 were created

Issue Available: @engcom-backlog-nazar, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.