Skip to content

Attribute option value uniqueness is not checked if created via REST Api #8846

@hilrob

Description

@hilrob

Preconditions

  1. Magento CE 2.1.4
  2. PHP 7.x
  3. MySQL 5.7

Steps to reproduce

  1. Send the same call to create an option twice
    URL: /rest/V1/products/attributes/color/options
    POST:
{
    "option": {
      "label": "Black1",
      "sort_order": 9999,
      "is_default": false
    }
}
  1. Get the attribute via API or check the backend
    Response:
[
  {
    "label": "offwhite/schwarz gestreift",
    "value": "281"
  },
  {
    "label": "red1",
    "value": "286"
  },
  {
    "label": "schwarz/mehrfarbig",
    "value": "282"
  },
  {
    "label": "Black1",
    "value": "287"
  },
  {
    "label": "Black1",
    "value": "288"
  },
  {
    "label": "Black1",
    "value": "289"
  }
]

Expected result

  1. Only one option value is created
  2. Second call must fail with exception

Actual result

  1. Option values are created more than once.

Metadata

Metadata

Assignees

Labels

Component: Framework/WebapiUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just CatalogFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions