-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REST API multiselect attribute values are sent in an incompatible format and cannot be cleared #6120
Comments
After 7th step I get updated product, if I send values:[] I get "Invalid option value" message. Only 4th point of expected is reproduced and it looks like improvement. |
I don't understand this comment. All four points of "expected" are what should happen. If any one of those points do not happen it is clearly a bug. |
In 2.1.1, Above actual results 1 though 4 still happen. This is still a bug and the tag should not have been removed. |
@mbrinton01 please review this one and confirm if bug or improvement |
Thank you for your submission. We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues. Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here). We are closing this GitHub ticket and have moved your request to the new forum. |
This is not a "feature request," it's a serious bug. How about letting the assignee weigh in on it before closing it? |
@dnadle, sorry for the confusion. This was picked up by an automated script. I've recreated it as a bug and we are tracking it internally as MAGETWO-58652. |
Thank you! |
Has there been any update on this issue, or a workaround that we could implement? |
@misha-kotov please research this issue |
I can confirm that this is still an issue on 2.1.6. We've found an inconsistency in the product model retrieving the value for a multiselect, getData() returns a comma delimited value yet getAttributeText() returns an array when there's multiple values (but a single string non-array when there's only one item). This inconsistency has lead to several issues we've had to accommodate in our customizations and I'm surprised this was reported in August 2016 with no updates/fixes. Our current workaround at the moment is to detect if the return value is a string, if so, we convert it to an array via explode(); or if empty string, set an empty array. |
Part of this fix is in progress and will be delivered to mainline soon. Namely, you'll be able to PUT the same payload that you received by doing a GET (ie, PUT will support string input). Since simply replacing string data type with arrays is a backwards incompatible change, we've decided to break it into a separate task for later and will combine with other backwards-incompatible changes in a later release where we'll likely have to version our APIs. |
…t in an incompatible format and cannot be cleared #6120
…t in an incompatible format and cannot be cleared #6120
…t in an incompatible format and cannot be cleared #6120
- MAGETWO-53431 [GITHUB] SOAP API Encoding Object has no 'label' property #4630 - MAGETWO-58652 [GitHub] REST API multiselect attribute values are sent in an incompatible format and cannot be cleared #6120 - MAGETWO-62567 Make static file versioning number not based on timestamp - MAGETWO-63741 [FT] Magento\Catalog\Test\TestCase\Product\CreateSimpleProductEntityTest fails on CI
The problem with not fixing this bug ASAP is that the only way to clear a multi-select field of all selections is to delete the product and re-create it, which breaks all links to that product in customers' order history, re-ordering, etc. I don't think you should wait until it's a convenient time from an API versioning perspective. There are other pragmatic ways to fix this bug. Instead of waiting to version the whole API, why not just send two versions of any multi-select field and accept either version in POST? For example, send: |
This issue was fixed in develop branch. |
@veloraven I could not find commit "MAGETWO-67765". Please provide correct name of the commit. Thank you. |
@Krekoss you should be looking for MAGETWO-58652 instead (commits into develop) |
@dnadle, thank you for your report. |
Issue still in 2.3 release |
I have exact the same problem with multiselect attributes. Is there a fix for the problem in magento 2.3? {"message":"Error occurred during \"customAttributes\" processing. Attribute \"base_size\" has invalid value. The \"array\" value's type is invalid. The \"string\" type was expected. Verify and try again.","trace":null} |
Preconditions
Steps to reproduce
<JSON GET result>
}.[]
(empty array).Expected result
Actual result
{ "message": "Error occurred during \"custom_attributes\" processing. Attribute \"occasion\" has invalid value. Invalid type for value: \"string\". Expected Type: \"string[]\"." }
The text was updated successfully, but these errors were encountered: