magento/magento2#33055: Validate filterable attribute input types on admin save - #41124
Open
swnsma wants to merge 1 commit into
Open
magento/magento2#33055: Validate filterable attribute input types on admin save#41124swnsma wants to merge 1 commit into
swnsma wants to merge 1 commit into
Conversation
Reject Use in Layered Navigation for catalog input types the admin form does not allow, using the same allowlist for admin save and REST.
|
Hi @swnsma. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed Issues
Manual testing scenarios
disabledfrom Use in Layered Navigation, set it to Filterable (with results), and save.POST /V1/products/attributes, create a text attribute withis_filterable: trueand verify400. Create a select/boolean attribute withis_filterable: trueand verify it still succeeds.Questions or comments
REST already enforced this in
ProductAttributeRepository::save()(after ACP2E-1422). Admin save never went through the repository ($model->save()), so the same invalid state could still be stored from the browser form by removing the HTMLdisabledattribute.This change consolidates that behaviour so admin and API use the same allowlist (
boolean,select,multiselect,price) viaFilterableAllowedInputTypes. The admin controller shows the existing form error and does not persist; REST still throwsInputException::invalidFieldValue.The repository check is now an allowlist matching the admin form, not the previous denylist. Types such as
media_image/gallerywithis_filterableare rejected on the API as well.Coverage: unit tests for the allowlist, admin save, and repository; integration tests for controller and repository create/update paths.