{"data":{"id":"magento2-36354","source":"github-pr","sourceRef":"magento/magento2#36354","title":"Different validation between attribute creation and update via REST API","pr":{"number":36354,"url":"https://github.com/magento/magento2/pull/36354","author":"rogerdz","mergedAt":"2026-01-06T14:46:47Z","mergeCommit":"e641fb28f05c4bcd25306458cd106c0347086f8d","headCommit":"398f7b3ea355b9ee2a9104389b57f7c2701a93b5","baseRef":"2.4-develop","diffSha256":"ec7f5d753e05d0ea5e6d226d4aed85bec5893cbbd10dffd9e6eec4b1476fe81b"},"issues":[{"number":36327,"url":"https://github.com/magento/magento2/issues/36327","title":"Different validation between attribute creation and update via REST API","labels":["Area: APIs","Component: Api","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: PR in progress","Progress: done","Reported on 2.4.4","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":"2.4.9","containingTags":["2.4.9"],"reportedOn":"2.4.4","codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"clean","2.4.8-p1":"clean","2.4.8-p2":"clean","2.4.8-p3":"clean","2.4.8-p4":"clean","2.4.8-p5":"clean","2.4.9":"conflict"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10","2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5"],"components":["magento/module-catalog"],"files":[{"path":"app/code/Magento/Catalog/Model/Product/Attribute/Repository.php","change":"modified","package":"magento/module-catalog"}],"stripped":{"tests":["app/code/Magento/Catalog/Test/Fixture/MultiselectAttribute.php","app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml","app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php","app/code/Magento/ConfigurableProduct/Test/Fixture/Attribute.php","app/code/Magento/Weee/Test/Fixture/Attribute.php","dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php","dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/AttributeTest.php"],"docs":[],"outsideCode":[]},"linesChanged":8,"mergeBatched":false,"excluded":null,"sections":{"description":"Wrong backend type is set on attribute","stepsToReproduce":"Issue a request following these criteria\n- Request method: POST\n- Endpoint: /rest/V1/products/attributes\n- example Body:\n{\n\"attribute\": {\n\"is*wysiwyg*enabled\": false,\n\"is*html_allowed_on*front\": false,\n\"used*for_sort*by\": false,\n\"is_filterable\": true,\n\"is*filterable_in*search\": true,\n\"is*used_in*grid\": true,\n\"is*visible_in*grid\": false,\n\"is*filterable_in*grid\": true,\n\"position\": 0,\n\"apply_to\": <],\n\"is_searchable\": \"1\",\n\"is*visible_in_advanced*search\": \"1\",\n\"is_comparable\": \"1\",\n\"is*used_for_promo*rules\": \"0\",\n\"is*visible_on*front\": \"0\",\n\"used*in_product*listing\": \"1\",\n\"is_visible\": true,\n\"scope\": \"global\",\n\"attribute_code\": \"brand\",\n\"frontend_input\": \"select\",\n\"entity*type*id\": \"4\",\n\"is_required\": false,\n\"options\": [\n{\n\"label\": \"test1\"\n},\n{\n\"label\": \"test2\"\n},\n{\n\"label\": \"test3\"\n}\n],\n\"is*user*defined\": true,\n\"default*frontend*label\": \"Brand\",\n\"frontend_labels\": null,\n\"backend_type\": \"decimal\",\n\"source_model\": \"Magento%5C%5CEav%5C%5CModel%5C%5CEntity%5C%5CAttribute%5C%5CSource%5C%5CTable\",\n\"default_value\": \"\",\n\"is_unique\": \"0\"\n}\n}\n-> attribute will be created, but with BE type text (due to getBackendTypeByInput() function)","expectedResult":"Correct backend*type will be created if valid in body, or throw exception if wrong backend_type provided or fallback to current behavior if backend*type not mentioned.","actualResult":"Wrong backend type is set on attribute\n\n\n[img width=\"950\" alt=\"Screenshot 2022-10-21 at 4 56 44 PM\" src=\"https://user-images.githubusercontent.com/51680745/197205328-2a519ab7-3208-48d0-a30b-9d3e79bf68f8.png\"]","source":"issue"},"signatures":[],"labels":{"area":["APIs"],"component":["Api"],"priority":"P2","severity":null,"reportedOn":["2.4.4"]},"categories":["Web API"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"384fe17b6c3c54caeea7a2a06fcd5b3d99de7537e5ba78ac80b1d7f5a6dac330","isBugfix":0.971,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9593,"feature":0.0083,"refactor":0.0161,"tests_only":0.0104,"docs_only":0.0028,"dependency":0.0031},"confidence":0.9048},"scope":{"score":1.1036,"probabilities":{"0":0.2012,"1":0.4941,"2":0.3047},"confidence":0.0662},"risk":{"score":0.5414,"probabilities":{"0":0.5511,"1":0.3564,"2":0.0925},"confidence":0.1589},"area":{"choice":"catalog","probabilities":{"catalog":0.6361,"checkout":0.0033,"customer":0.0028,"admin":0.0256,"graphql_api":0.3116,"framework":0.0087,"frontend":0.0049,"other":0.007},"confidence":0.4315},"securityRelevant":0.0058,"reportedVersion":{"choice":"2.4.4","probabilities":{"2.4.0":0.002,"2.4.0-p1":0.0021,"2.4.1":0.0021,"2.4.1-p1":0.002,"2.4.2":0.0041,"2.4.2-p1":0.0027,"2.4.2-p2":0.0038,"2.4.3":0.0092,"2.4.3-p1":0.0071,"2.4.3-p2":0.0092,"2.4.3-p3":0.0054,"2.4.4":0.5551,"2.4.4-p1":0.0271,"2.4.4-p10":0.0089,"2.4.4-p11":0.0121,"2.4.4-p12":0.0085,"2.4.4-p13":0.008,"2.4.4-p14":0.0091,"2.4.4-p15":0.0072,"2.4.4-p16":0.0097,"2.4.4-p17":0.0075,"2.4.4-p18":0.0063,"2.4.4-p2":0.0074,"2.4.4-p3":0.0082,"2.4.4-p4":0.0104,"2.4.4-p5":0.0092,"2.4.4-p6":0.012,"2.4.4-p7":0.0101,"2.4.4-p8":0.0074,"2.4.4-p9":0.0053,"2.4.5":0.0047,"2.4.5-p1":0.0036,"2.4.5-p10":0.0026,"2.4.5-p11":0.0035,"2.4.5-p12":0.0045,"2.4.5-p13":0.0034,"2.4.5-p14":0.0033,"2.4.5-p15":0.0027,"2.4.5-p16":0.0022,"2.4.5-p17":0.0029,"2.4.5-p2":0.0023,"2.4.5-p3":0.0026,"2.4.5-p4":0.0035,"2.4.5-p5":0.0024,"2.4.5-p6":0.003,"2.4.5-p7":0.0026,"2.4.5-p8":0.0027,"2.4.5-p9":0.0018,"2.4.6":0.0038,"2.4.6-p1":0.0038,"2.4.6-p10":0.0032,"2.4.6-p11":0.004,"2.4.6-p12":0.0029,"2.4.6-p13":0.0033,"2.4.6-p14":0.003,"2.4.6-p15":0.0025,"2.4.6-p2":0.0022,"2.4.6-p3":0.0031,"2.4.6-p4":0.0043,"2.4.6-p5":0.0032,"2.4.6-p6":0.003,"2.4.6-p7":0.0031,"2.4.6-p8":0.0026,"2.4.6-p9":0.002,"2.4.7":0.003,"2.4.7-p1":0.0029,"2.4.7-p10":0.0032,"2.4.7-p2":0.0026,"2.4.7-p3":0.0041,"2.4.7-p4":0.0064,"2.4.7-p5":0.0047,"2.4.7-p6":0.0061,"2.4.7-p7":0.0044,"2.4.7-p8":0.0042,"2.4.7-p9":0.0022,"2.4.8":0.0027,"2.4.8-p1":0.0032,"2.4.8-p2":0.0038,"2.4.8-p3":0.0046,"2.4.8-p4":0.0061,"2.4.8-p5":0.0045,"2.4.9":0.0036,"unspecified":0.0442},"confidence":0.3048},"backportWorthy":{"score":1.5078,"probabilities":{"0":0.1008,"1":0.2906,"2":0.6086},"confidence":0.1975}},"curated":{"title":"Fixes REST attribute creation silently replacing a wrong backend_type","description":"A POST to /rest/V1/products/attributes with a backend_type in the body creates the attribute, but with the backend type from getBackendTypeByInput(), so the wrong backend type is set on attribute. The Catalog Product Attribute Repository save now will throw InputException invalidFieldValue if the backend_type provided is not the one for the frontend_input.","categories":["Web API"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:20:52.743Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:20:52.743Z"},"integration":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:20:52.743Z"}}},"2.4.7-p10":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:30:16.656Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:30:16.656Z"},"integration":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:30:16.656Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-36354 details"}