Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove the deprecated attribute presentation flags from the GraphQL API (#19675)
Lukasz Ostrowski9ecb635bca82
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 30b7ec1943..20777a8795 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -37,6 +37,7 @@ All notable, unreleased changes to this project will be documented in this file.- `attributeBulkCreate` and `attributeBulkUpdate` already resolved the permission from the attribute type. They now reject an attribute type that has no permission mapped, instead of falling back to `MANAGE_PAGE_TYPES_AND_ATTRIBUTES`.To upgrade, grant staff members and apps the permission matching the attribute types they operate on. A requestor holding only `MANAGE_PRODUCTS` can no longer create attribute values.+- Removed the deprecated storefront and dashboard presentation flags of attributes: `filterableInStorefront`, `filterableInDashboard`, `availableInGrid` and `storefrontSearchPosition`. Saleor never read them. Every surface exposing them is gone: the fields of the `Attribute` type, the inputs of `AttributeCreateInput` and `AttributeUpdateInput` (which also covers `attributeBulkCreate` and `attributeBulkUpdate`), the `filterableInStorefront`, `availableInGrid` and `filterableInDashboard` inputs of `AttributeFilterInput`, the `filterableInDashboard` input of `AttributeWhereInput`, and the `FILTERABLE_IN_STOREFRONT`, `FILTERABLE_IN_DASHBOARD`, `AVAILABLE_IN_GRID` and `STOREFRONT_SEARCH_POSITION` values of `AttributeSortField`. Keep the logic in the storefront or dashboard, or use `Attribute` metadata instead. The database columns are still present and will be dropped in a later release.- Providing an empty `attributes` list (`null` or `[]`) in `where` filters for pages, products, and product variants now matches no objects instead of being ignored. The same now applies to a no-op attribute filter that builds no condition, such as an empty reference container (`reference: { pageSlugs: {} }`) - previously such a filter matched all product variants.### GraphQL APIdiff --git a/saleor/attribute/__init__.py b/saleor/attribute/__init__.pyindex f2ec0fdfc1..e8965f087b 100644--- a/saleor/attribute/__init__.py+++ b/saleor/attribute/__init__.py@@ -57,44 +57,6 @@ class AttributeInputType:]-ATTRIBUTE_PROPERTIES_CONFIGURATION = {- "filterable_in_storefront": [- AttributeInputType.DROPDOWN,- AttributeInputType.MULTISELECT,- AttributeInputType.NUMERIC,- AttributeInputType.SWATCH,- AttributeInputType.BOOLEAN,- AttributeInputType.DATE,- AttributeInputType.DATE_TIME,- ],- "filterable_in_dashboard": [- AttributeInputType.DROPDOWN,- AttributeInputType.MULTISELECT,- AttributeInputType.NUMERIC,- AttributeInputType.SWATCH,- AttributeInputType.BOOLEAN,- AttributeInputType.DATE,- AttributeInputType.DATE_TIME,- ],- "available_in_grid": [- AttributeInputType.DROPDOWN,- AttributeInputType.MULTISELECT,- AttributeInputType.NUMERIC,- AttributeInputType.SWATCH,- AttributeInputType.BOOLEAN,- AttributeInputType.DATE,- AttributeInputType.DATE_TIME,- ],- "storefront_search_position": [- AttributeInputType.DROPDOWN,- AttributeInputType.MULTISELECT,- AttributeInputType.BOOLEAN,- AttributeInputType.DATE,- AttributeInputType.DATE_TIME,- ],-}--class AttributeType:PRODUCT_TYPE = "product-type"PAGE_TYPE = "page-type"diff --git a/saleor/attribute/models/base.py b/saleor/attribute/models/base.pyindex 0e3db729e5..1fd6747a41 100644--- a/saleor/attribute/models/base.py+++ b/saleor/attribute/models/base.py@@ -202,16 +202,22 @@ class Attribute(ModelWithMetadata, ModelWithExternalReference):is_variant_only = models.BooleanField(default=False, blank=True)visible_in_storefront = models.BooleanField(default=True, blank=True)+ # Presentation flags that Saleor never reads. Their GraphQL API surface was+ # removed in 3.24; the fields and their columns are to be dropped too. Dropping+ # `storefront_search_position` also changes the default ordering below.filterable_in_storefront = models.BooleanField(default=False, blank=True)filterable_in_dashboard = models.BooleanField(default=False, blank=True)storefront_search_position = models.IntegerField(default=0, blank=True)available_in_grid = models.BooleanField(default=False, blank=True)+max_sort_order = models.IntegerField(default=None, null=True, blank=True)objects = AttributeManager()class Meta(ModelWithMetadata.Meta):+ # `storefront_search_position` is a leftover of the removed presentation+ # flags; ordering falls back to `slug` when the column is dropped.ordering = ("storefront_search_position", "slug")indexes = [*ModelWithMetadata.Meta.indexes,diff --git a/saleor/graphql/attribute/descriptions.py b/saleor/graphql/attribute/descriptions.pyindex bc52fc420c..20c448317e 100644--- a/saleor/graphql/attribute/descriptions.py+++ b/saleor/graphql/attribute/descriptions.py@@ -1,15 +1,5 @@from ..core.descriptions import RICH_CONTENT-STOREFRONT_FLAG_DEPRECATION_REASON = (- "This flag is not used by Saleor. Keep the logic in the storefront or use "- "`Attribute` metadata instead."-)--DASHBOARD_FLAG_DEPRECATION_REASON = (- "This flag is not used by Saleor. Keep the logic in the dashboard or use "- "`Attribute` metadata instead."-)-class AttributeDescriptions:INPUT_TYPE = "The input type to use for entering attribute values in the dashboard."@@ -25,14 +15,6 @@ class AttributeDescriptions:VISIBLE_IN_STOREFRONT = ("Whether the attribute should be visible or not in storefront.")- FILTERABLE_IN_STOREFRONT = "Whether the attribute can be filtered in storefront."- FILTERABLE_IN_DASHBOARD = "Whether the attribute can be filtered in dashboard."- STOREFRONT_SEARCH_POSITION = (- "The position of the attribute in the storefront navigation (0 by default)."- )- AVAILABLE_IN_GRID = (- "Whether the attribute can be displayed in the admin product list."- )WITH_CHOICES = "Flag indicating that attribute has predefined choices."diff --git a/saleor/graphql/attribute/filters.py b/saleor/graphql/attribute/filters.pyindex 27ca29184d..06dbd66cc5 100644--- a/saleor/graphql/attribute/filters.py+++ b/saleor/graphql/attribute/filters.py@@ -11,7 +11,6 @@ from ...permission.utils import has_one_of_permissionsfrom ...product import models as product_modelsfrom ...product.models import ALL_PRODUCTS_PERMISSIONSfrom ..channel.filters import get_channel_slug_from_filter_data-from ..core.descriptions import DEPRECATED_IN_3X_INPUTfrom ..core.doc_category import DOC_CATEGORY_ATTRIBUTESfrom ..core.enums import MeasurementUnitsEnumfrom ..core.filters import (@@ -39,11 +38,6 @@ from ..core.types.common import NonNullListfrom ..core.utils import from_global_id_or_errorfrom ..utils import get_user_or_app_from_contextfrom ..utils.filters import filter_by_ids, filter_slug_list, filter_where_by_value_field-from .descriptions import (- DASHBOARD_FLAG_DEPRECATION_REASON,- STOREFRONT_FLAG_DEPRECATION_REASON,- AttributeDescriptions,-)from .enums import AttributeEntityTypeEnum, AttributeInputTypeEnum, AttributeTypeEnum@@ -142,24 +136,6 @@ class AttributeFilter(MetadataFilterBase):in_collection = GlobalIDFilter(method="filter_in_collection")in_category = GlobalIDFilter(method="filter_in_category")slugs = ListObjectTypeFilter(input_class=graphene.String, method=filter_slug_list)- filterable_in_storefront = django_filters.BooleanFilter(- help_text=(- f"{AttributeDescriptions.FILTERABLE_IN_STOREFRONT}"- f"{DEPRECATED_IN_3X_INPUT} {STOREFRONT_FLAG_DEPRECATION_REASON}"- )- )- available_in_grid = django_filters.BooleanFilter(- help_text=(- f"{AttributeDescriptions.AVAILABLE_IN_GRID}"- f"{DEPRECATED_IN_3X_INPUT} {STOREFRONT_FLAG_DEPRECATION_REASON}"- )- )- filterable_in_dashboard = django_filters.BooleanFilter(- help_text=(- f"{AttributeDescriptions.FILTERABLE_IN_DASHBOARD}"- f"{DEPRECATED_IN_3X_INPUT} {DASHBOARD_FLAG_DEPRECATION_REASON}"- )- )class Meta:model = Attribute@@ -309,12 +285,6 @@ class AttributeWhere(MetadataWhereFilterBase):in_category = GlobalIDWhereFilter(method="filter_in_category")value_required = BooleanWhereFilter()visible_in_storefront = BooleanWhereFilter()- filterable_in_dashboard = BooleanWhereFilter(- help_text=(- f"{AttributeDescriptions.FILTERABLE_IN_DASHBOARD}"- f"{DEPRECATED_IN_3X_INPUT} {DASHBOARD_FLAG_DEPRECATION_REASON}"- )- )class Meta:model = Attributediff --git a/saleor/graphql/attribute/mutations/attribute_bulk_create.py b/saleor/graphql/attribute/mutations/attribute_bulk_create.pyindex cace02c2f9..596872e5f7 100644--- a/saleor/graphql/attribute/mutations/attribute_bulk_create.py+++ b/saleor/graphql/attribute/mutations/attribute_bulk_create.py@@ -7,12 +7,7 @@ from django.utils.text import slugifyfrom graphene.utils.str_converters import to_camel_casefrom text_unidecode import unidecode-from ....attribute import (- ATTRIBUTE_PROPERTIES_CONFIGURATION,- AttributeEntityType,- AttributeInputType,- models,-)+from ....attribute import AttributeEntityType, AttributeInputType, modelsfrom ....attribute.error_codes import AttributeBulkCreateErrorCodefrom ....core.tracing import traced_atomic_transactionfrom ....core.utils import prepare_unique_slug@@ -32,11 +27,6 @@ from .mixins import AttributeMixinfrom .permissions import ATTRIBUTE_TYPE_PERMISSION_MAPONLY_SWATCH_FIELDS = ["file_url", "content_type", "value"]-DEPRECATED_ATTR_FIELDS = [- "storefront_search_position",- "filterable_in_storefront",- "available_in_grid",-]DEPRECATED_VALUE_FIELDS = ["rich_text", "plain_text"]@@ -326,21 +316,6 @@ class AttributeBulkCreate(BaseMutation):cleaned_inputs_map[attribute_index] = Nonecontinue- if any(key in DEPRECATED_ATTR_FIELDS for key in attribute_data.keys()):- message = (- "Deprecated fields 'storefront_search_position', "- "'filterable_in_storefront', 'available_in_grid' and are not "- "allowed in bulk mutation."- )- index_error_map[attribute_index].append(- AttributeBulkCreateError(- message=message,- code=AttributeBulkCreateErrorCode.INVALID.value,- )- )- cleaned_inputs_map[attribute_index] = None- continue-try:AttributeMixin.validate_reference_types_limit(attribute_data)except ValidationError as e:@@ -425,24 +400,6 @@ class AttributeBulkCreate(BaseMutation):)return None- # check attribute configuration- for field in ATTRIBUTE_PROPERTIES_CONFIGURATION.keys():- allowed_input_type = ATTRIBUTE_PROPERTIES_CONFIGURATION[field]-- if input_type not in allowed_input_type and cleaned_input.get(field):- camel_case_field = to_camel_case(field)- index_error_map[attribute_index].append(- AttributeBulkCreateError(- path=camel_case_field,- message=(- f"Cannot set {camel_case_field} on a {input_type} "- "attribute.",- ),- code=AttributeBulkCreateErrorCode.INVALID.value,- )- )- return None-entity_type = cast(str, entity_type)try:AttributeMixin.clean_reference_types(cleaned_input, entity_type, input_type)diff --git a/saleor/graphql/attribute/mutations/attribute_bulk_update.py b/saleor/graphql/attribute/mutations/attribute_bulk_update.pyindex 93890f289b..bd63d79873 100644--- a/saleor/graphql/attribute/mutations/attribute_bulk_update.py+++ b/saleor/graphql/attribute/mutations/attribute_bulk_update.py@@ -43,7 +43,7 @@ from ...core.utils import (from ...core.validators import validate_one_of_args_is_in_mutationfrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import Attribute-from .attribute_bulk_create import DEPRECATED_ATTR_FIELDS, clean_values+from .attribute_bulk_create import clean_valuesfrom .attribute_update import AttributeUpdateInputfrom .mixins import AttributeMixinfrom .permissions import ATTRIBUTE_TYPE_PERMISSION_MAP@@ -193,23 +193,6 @@ class AttributeBulkUpdate(BaseMutation):cleaned_inputs_map[attribute_index] = Nonecontinue- if any(- key in DEPRECATED_ATTR_FIELDS for key in attribute_data.fields.keys()- ):- message = (- "Deprecated fields 'storefront_search_position', "- "'filterable_in_storefront', 'available_in_grid' and are not "- "allowed in bulk mutation."- )- index_error_map[attribute_index].append(- AttributeBulkUpdateError(- message=message,- code=AttributeBulkUpdateErrorCode.INVALID.value,- )- )- cleaned_inputs_map[attribute_index] = None- continue-if attribute_data.id:try:obj_type, db_id = from_global_id_or_error(@@ -727,7 +710,6 @@ class AttributeBulkUpdate(BaseMutation):"value_required","visible_in_storefront","is_variant_only",- "filterable_in_dashboard","external_reference",],)diff --git a/saleor/graphql/attribute/mutations/attribute_create.py b/saleor/graphql/attribute/mutations/attribute_create.pyindex e0adaf4ad0..a7ce00adfa 100644--- a/saleor/graphql/attribute/mutations/attribute_create.py+++ b/saleor/graphql/attribute/mutations/attribute_create.py@@ -15,12 +15,7 @@ from ...core.mutations import DeprecatedModelMutationfrom ...core.types import AttributeError, BaseInputObjectType, NonNullListfrom ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promise-from ..descriptions import (- DASHBOARD_FLAG_DEPRECATION_REASON,- STOREFRONT_FLAG_DEPRECATION_REASON,- AttributeDescriptions,- AttributeValueDescriptions,-)+from ..descriptions import AttributeDescriptions, AttributeValueDescriptionsfrom ..enums import AttributeEntityTypeEnum, AttributeInputTypeEnum, AttributeTypeEnumfrom ..types import Attributefrom .mixins import REFERENCE_TYPES_LIMIT, AttributeMixin@@ -79,32 +74,6 @@ class AttributeCreateInput(BaseInputObjectType):visible_in_storefront = graphene.Boolean(description=AttributeDescriptions.VISIBLE_IN_STOREFRONT)- filterable_in_storefront = graphene.Boolean(- description=AttributeDescriptions.FILTERABLE_IN_STOREFRONT- + DEPRECATED_IN_3X_INPUT- + " "- + STOREFRONT_FLAG_DEPRECATION_REASON- )- filterable_in_dashboard = graphene.Boolean(- description=AttributeDescriptions.FILTERABLE_IN_DASHBOARD- + DEPRECATED_IN_3X_INPUT- + " "- + DASHBOARD_FLAG_DEPRECATION_REASON- )- storefront_search_position = graphene.Int(- required=False,- description=AttributeDescriptions.STOREFRONT_SEARCH_POSITION- + DEPRECATED_IN_3X_INPUT- + " "- + STOREFRONT_FLAG_DEPRECATION_REASON,- )- available_in_grid = graphene.Boolean(- required=False,- description=AttributeDescriptions.AVAILABLE_IN_GRID- + DEPRECATED_IN_3X_INPUT- + " "- + STOREFRONT_FLAG_DEPRECATION_REASON,- )external_reference = graphene.String(description="External ID of this attribute.", required=False)@@ -126,12 +95,7 @@ class AttributeCreateInput(BaseInputObjectType):class Meta:doc_category = DOC_CATEGORY_ATTRIBUTES- description = (- "Represents an input for create of attribute.\n\n"- "NOTE: Deprecated fields `filterableInStorefront`, "- "`storefrontSearchPosition` and `availableInGrid` are not supported in "- "bulk mutations: `attributeBulkCreate`, `attributeBulkUpdate`."- )+ description = "Represents an input for create of attribute."class AttributeCreate(AttributeMixin, DeprecatedModelMutation):diff --git a/saleor/graphql/attribute/mutations/attribute_update.py b/saleor/graphql/attribute/mutations/attribute_update.pyindex f7f016b799..c771f48f77 100644--- a/saleor/graphql/attribute/mutations/attribute_update.py+++ b/saleor/graphql/attribute/mutations/attribute_update.py@@ -10,19 +10,14 @@ from ....product.utils.search_helpers import (from ....webhook.event_types import WebhookEventAsyncTypefrom ...core import ResolveInfofrom ...core.context import ChannelContext-from ...core.descriptions import ADDED_IN_322, DEPRECATED_IN_3X_INPUT+from ...core.descriptions import ADDED_IN_322from ...core.doc_category import DOC_CATEGORY_ATTRIBUTESfrom ...core.enums import MeasurementUnitsEnumfrom ...core.mutations import ModelWithExtRefMutationfrom ...core.types import AttributeError, BaseInputObjectType, NonNullListfrom ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promise-from ..descriptions import (- DASHBOARD_FLAG_DEPRECATION_REASON,- STOREFRONT_FLAG_DEPRECATION_REASON,- AttributeDescriptions,- AttributeValueDescriptions,-)+from ..descriptions import AttributeDescriptions, AttributeValueDescriptionsfrom ..types import Attributefrom .attribute_create import AttributeValueInputfrom .mixins import REFERENCE_TYPES_LIMIT, AttributeMixin@@ -64,32 +59,6 @@ class AttributeUpdateInput(BaseInputObjectType):visible_in_storefront = graphene.Boolean(description=AttributeDescriptions.VISIBLE_IN_STOREFRONT)- filterable_in_storefront = graphene.Boolean(- description=AttributeDescriptions.FILTERABLE_IN_STOREFRONT- + DEPRECATED_IN_3X_INPUT- + " "- + STOREFRONT_FLAG_DEPRECATION_REASON- )- filterable_in_dashboard = graphene.Boolean(- description=AttributeDescriptions.FILTERABLE_IN_DASHBOARD- + DEPRECATED_IN_3X_INPUT- + " "- + DASHBOARD_FLAG_DEPRECATION_REASON- )- storefront_search_position = graphene.Int(- required=False,- description=AttributeDescriptions.STOREFRONT_SEARCH_POSITION- + DEPRECATED_IN_3X_INPUT- + " "- + STOREFRONT_FLAG_DEPRECATION_REASON,- )- available_in_grid = graphene.Boolean(- required=False,- description=AttributeDescriptions.AVAILABLE_IN_GRID- + DEPRECATED_IN_3X_INPUT- + " "- + STOREFRONT_FLAG_DEPRECATION_REASON,- )external_reference = graphene.String(description="External ID of this product.", required=False)@@ -111,12 +80,7 @@ class AttributeUpdateInput(BaseInputObjectType):class Meta:doc_category = DOC_CATEGORY_ATTRIBUTES- description = (- "Represents an input for update of attribute.\n\n"- "NOTE: Deprecated fields `filterableInStorefront`, "- "`storefrontSearchPosition` and `availableInGrid` are not supported in "- "bulk mutations: `attributeBulkCreate`, `attributeBulkUpdate`."- )+ description = "Represents an input for update of attribute."class AttributeUpdate(AttributeMixin, ModelWithExtRefMutation):diff --git a/saleor/graphql/attribute/mutations/mixins.py b/saleor/graphql/attribute/mutations/mixins.pyindex 5fd3151f75..4908deebcb 100644--- a/saleor/graphql/attribute/mutations/mixins.py+++ b/saleor/graphql/attribute/mutations/mixins.py@@ -4,11 +4,7 @@ from django.core.exceptions import ValidationErrorfrom django.utils.text import slugifyfrom text_unidecode import unidecode-from ....attribute import (- ATTRIBUTE_PROPERTIES_CONFIGURATION,- AttributeEntityType,- AttributeInputType,-)+from ....attribute import AttributeEntityType, AttributeInputTypefrom ....attribute import models as modelsfrom ....attribute.error_codes import AttributeErrorCodefrom ....core.utils import prepare_unique_slug@@ -193,7 +189,6 @@ class AttributeMixin:except ValidationError as e:e.code = AttributeErrorCode.REQUIRED.valueraise ValidationError({"slug": e}) from e- cls._clean_attribute_settings(instance, cleaned_input)entity_type = cleaned_input.get("entity_type") or instance.entity_typeinput_type = cleaned_input.get("input_type") or instance.input_typeentity_type = cast(str, entity_type)@@ -201,26 +196,6 @@ class AttributeMixin:return cleaned_input- @classmethod- def _clean_attribute_settings(cls, instance, cleaned_input):- """Validate attributes settings.-- Ensure that any invalid operations will be not performed.- """- attribute_input_type = cleaned_input.get("input_type") or instance.input_type- errors = {}- for field in ATTRIBUTE_PROPERTIES_CONFIGURATION.keys():- allowed_input_type = ATTRIBUTE_PROPERTIES_CONFIGURATION[field]- if attribute_input_type not in allowed_input_type and cleaned_input.get(- field- ):- errors[field] = ValidationError(- f"Cannot set {field} on a {attribute_input_type} attribute.",- code=AttributeErrorCode.INVALID.value,- )- if errors:- raise ValidationError(errors)-@classmethoddef clean_reference_types(cls, cleaned_input: dict, entity_type: str, input_type: strdiff --git a/saleor/graphql/attribute/sorters.py b/saleor/graphql/attribute/sorters.pyindex 515b6e0ead..9df172f181 100644--- a/saleor/graphql/attribute/sorters.py+++ b/saleor/graphql/attribute/sorters.py@@ -1,9 +1,5 @@from ..core.doc_category import DOC_CATEGORY_ATTRIBUTESfrom ..core.types import BaseEnum, SortInputObjectType-from .descriptions import (- DASHBOARD_FLAG_DEPRECATION_REASON,- STOREFRONT_FLAG_DEPRECATION_REASON,-)class AttributeSortField(BaseEnum):@@ -12,10 +8,6 @@ class AttributeSortField(BaseEnum):VALUE_REQUIRED = ["value_required", "name", "slug"]IS_VARIANT_ONLY = ["is_variant_only", "name", "slug"]VISIBLE_IN_STOREFRONT = ["visible_in_storefront", "name", "slug"]- FILTERABLE_IN_STOREFRONT = ["filterable_in_storefront", "name", "slug"]- FILTERABLE_IN_DASHBOARD = ["filterable_in_dashboard", "name", "slug"]- STOREFRONT_SEARCH_POSITION = ["storefront_search_position", "name", "pk"]- AVAILABLE_IN_GRID = ["available_in_grid", "name", "pk"]class Meta:doc_category = DOC_CATEGORY_ATTRIBUTES@@ -35,35 +27,11 @@ class AttributeSortField(BaseEnum):AttributeSortField.VISIBLE_IN_STOREFRONT.name: ( # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501"Sort attributes by visibility in the storefront"),- AttributeSortField.FILTERABLE_IN_STOREFRONT.name: ( # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- "Sort attributes by the filterable in storefront flag"- ),- AttributeSortField.FILTERABLE_IN_DASHBOARD.name: ( # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- "Sort attributes by the filterable in dashboard flag"- ),- AttributeSortField.STOREFRONT_SEARCH_POSITION.name: ( # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- "Sort attributes by their position in storefront"- ),- AttributeSortField.AVAILABLE_IN_GRID.name: ( # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- "Sort attributes based on whether they can be displayed "- "or not in a product grid."- ),}if self.name in descriptions:return descriptions[self.name]raise ValueError(f"Unsupported enum value: {self.value}")- @property- def deprecation_reason(self):- # pylint: disable=no-member- deprecations = {- AttributeSortField.FILTERABLE_IN_STOREFRONT.name: STOREFRONT_FLAG_DEPRECATION_REASON, # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- AttributeSortField.STOREFRONT_SEARCH_POSITION.name: STOREFRONT_FLAG_DEPRECATION_REASON, # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- AttributeSortField.AVAILABLE_IN_GRID.name: STOREFRONT_FLAG_DEPRECATION_REASON, # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- AttributeSortField.FILTERABLE_IN_DASHBOARD.name: DASHBOARD_FLAG_DEPRECATION_REASON, # type: ignore[attr-defined] # graphene.Enum is not typed # noqa: E501- }- return deprecations.get(self.name)-class AttributeSortingInput(SortInputObjectType):class Meta:diff --git a/saleor/graphql/attribute/tests/benchmark/test_attribute.py b/saleor/graphql/attribute/tests/benchmark/test_attribute.pyindex 18d7019595..0d850d90f9 100644--- a/saleor/graphql/attribute/tests/benchmark/test_attribute.py+++ b/saleor/graphql/attribute/tests/benchmark/test_attribute.py@@ -32,10 +32,6 @@ def test_query_attribute(}valueRequiredvisibleInStorefront- filterableInStorefront- filterableInDashboard- availableInGrid- storefrontSearchPosition}}"""@@ -78,10 +74,6 @@ def test_query_attributes(}valueRequiredvisibleInStorefront- filterableInStorefront- filterableInDashboard- availableInGrid- storefrontSearchPosition}}}diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_create.py b/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_create.pyindex f7daec1e25..c7d4e71c37 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_create.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_create.py@@ -183,101 +183,6 @@ def test_attribute_bulk_create_without_permission(staff_api_client):assert data["count"] == 0-def test_attribute_bulk_create_with_deprecated_field(staff_api_client):- # given- attribute_1_name = "Example name 1"- external_reference_1 = "test-ext-ref-1"-- attributes = [- {- "name": attribute_1_name,- "externalReference": external_reference_1,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "filterableInStorefront": True,- }- ]-- # when- response = staff_api_client.post_graphql(- ATTRIBUTE_BULK_CREATE_MUTATION,- {"attributes": attributes},- )- content = get_graphql_content(response)- data = content["data"]["attributeBulkCreate"]-- # then- attributes = Attribute.objects.all()- errors = data["results"][0]["errors"]- message = (- "Deprecated fields 'storefront_search_position', "- "'filterable_in_storefront', 'available_in_grid' and are not "- "allowed in bulk mutation."- )-- assert len(attributes) == 0- assert data["count"] == 0- assert errors- assert errors[0]["code"] == AttributeBulkCreateErrorCode.INVALID.name- assert errors[0]["message"] == message---def test_attribute_bulk_create_with_file_input_type_and_invalid_settings(- staff_api_client,- permission_manage_product_types_and_attributes,- permission_manage_products,-):- # given- attribute_1_name = "Example name 1"- attribute_2_name = "Example name 2"- external_reference_1 = "test-ext-ref-1"- external_reference_2 = "test-ext-ref-2"-- attributes = [- {- "name": attribute_1_name,- "externalReference": external_reference_1,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "inputType": AttributeInputTypeEnum.FILE.name,- "filterableInDashboard": True,- },- {- "name": attribute_2_name,- "externalReference": external_reference_2,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "inputType": AttributeInputTypeEnum.FILE.name,- "filterableInDashboard": True,- },- ]-- # when- staff_api_client.user.user_permissions.add(- permission_manage_product_types_and_attributes- )- response = staff_api_client.post_graphql(- ATTRIBUTE_BULK_CREATE_MUTATION, {"attributes": attributes}- )- content = get_graphql_content(response)- data = content["data"]["attributeBulkCreate"]-- # then- attributes = Attribute.objects.all()-- errors_1 = data["results"][0]["errors"]- errors_2 = data["results"][1]["errors"]-- assert len(attributes) == 0- assert errors_1- assert errors_2- assert data["count"] == 0-- assert {error["path"] for error in errors_1 + errors_2} == {- "filterableInDashboard",- }- assert {error["code"] for error in errors_1 + errors_2} == {- AttributeBulkCreateErrorCode.INVALID.name- }--def test_attribute_bulk_create_with_duplicated_external_ref(staff_api_client,permission_manage_product_types_and_attributes,diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_update.py b/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_update.pyindex 6efa4e38f8..90982d6aea 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_update.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_bulk_update.py@@ -169,40 +169,6 @@ def test_attribute_bulk_update_without_permission(assert errors-def test_attribute_bulk_update_with_deprecated_fields(- staff_api_client,- color_attribute,-):- # given- attributes = [- {- "id": graphene.Node.to_global_id("Attribute", color_attribute.id),- "fields": {"filterableInStorefront": True},- }- ]-- # when- response = staff_api_client.post_graphql(- ATTRIBUTE_BULK_UPDATE_MUTATION,- {"attributes": attributes},- )- content = get_graphql_content(response)- data = content["data"]["attributeBulkUpdate"]-- # then- errors = data["results"][0]["errors"]- message = (- "Deprecated fields 'storefront_search_position', "- "'filterable_in_storefront', 'available_in_grid' and are not "- "allowed in bulk mutation."- )-- assert data["count"] == 0- assert errors- assert errors[0]["code"] == AttributeBulkUpdateErrorCode.INVALID.name- assert errors[0]["message"] == message--def test_attribute_bulk_update_with_duplicated_external_ref(staff_api_client,color_attribute,diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_create.py b/saleor/graphql/attribute/tests/mutations/test_attribute_create.pyindex 159801433f..ce49893149 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_create.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_create.py@@ -44,10 +44,6 @@ CREATE_ATTRIBUTE_MUTATION = """slug}}- filterableInStorefront- filterableInDashboard- availableInGrid- storefrontSearchPositionexternalReferencechoices(first: 10) {edges {@@ -209,9 +205,6 @@ def test_create_numeric_attribute_and_attribute_values("type": AttributeTypeEnum.PRODUCT_TYPE.name,"unit": MeasurementUnitsEnum.M.name,"inputType": AttributeInputTypeEnum.NUMERIC.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,}}@@ -250,9 +243,6 @@ def test_create_numeric_attribute_and_attribute_values_not_numeric_value_provide"type": AttributeTypeEnum.PRODUCT_TYPE.name,"unit": MeasurementUnitsEnum.M.name,"inputType": AttributeInputTypeEnum.NUMERIC.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,}}@@ -293,9 +283,6 @@ def test_create_swatch_attribute_and_attribute_values_only_name_provided("values": [{"name": name}],"type": AttributeTypeEnum.PRODUCT_TYPE.name,"inputType": AttributeInputTypeEnum.SWATCH.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,}}@@ -328,10 +315,6 @@ def test_create_swatch_attribute_and_attribute_values_only_name_provided(assert data["attribute"]["type"] == AttributeTypeEnum.PRODUCT_TYPE.nameassert data["attribute"]["unit"] is Noneassert data["attribute"]["inputType"] == AttributeInputTypeEnum.SWATCH.name- assert data["attribute"]["filterableInStorefront"] is True- assert data["attribute"]["filterableInDashboard"] is True- assert data["attribute"]["availableInGrid"] is True- assert data["attribute"]["storefrontSearchPosition"] == 0assert data["attribute"]["choices"]["edges"][0]["node"]["name"] == nameassert data["attribute"]["choices"]["edges"][0]["node"]["slug"] == slugify(name)@@ -356,9 +339,6 @@ def test_create_swatch_attribute_and_attribute_values_with_file(],"type": AttributeTypeEnum.PRODUCT_TYPE.name,"inputType": AttributeInputTypeEnum.SWATCH.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,}}@@ -391,10 +371,6 @@ def test_create_swatch_attribute_and_attribute_values_with_file(assert data["attribute"]["type"] == AttributeTypeEnum.PRODUCT_TYPE.nameassert data["attribute"]["unit"] is Noneassert data["attribute"]["inputType"] == AttributeInputTypeEnum.SWATCH.name- assert data["attribute"]["filterableInStorefront"] is True- assert data["attribute"]["filterableInDashboard"] is True- assert data["attribute"]["availableInGrid"] is True- assert data["attribute"]["storefrontSearchPosition"] == 0assert data["attribute"]["choices"]["edges"][0]["node"]["name"] == nameassert data["attribute"]["choices"]["edges"][0]["node"]["slug"] == slugify(name)assert data["attribute"]["choices"]["edges"][0]["node"]["file"] == {@@ -420,9 +396,6 @@ def test_create_swatch_attribute_and_attribute_values_with_value("values": [{"name": name, "value": value}],"type": AttributeTypeEnum.PRODUCT_TYPE.name,"inputType": AttributeInputTypeEnum.SWATCH.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,}}@@ -455,10 +428,6 @@ def test_create_swatch_attribute_and_attribute_values_with_value(assert data["attribute"]["type"] == AttributeTypeEnum.PRODUCT_TYPE.nameassert data["attribute"]["unit"] is Noneassert data["attribute"]["inputType"] == AttributeInputTypeEnum.SWATCH.name- assert data["attribute"]["filterableInStorefront"] is True- assert data["attribute"]["filterableInDashboard"] is True- assert data["attribute"]["availableInGrid"] is True- assert data["attribute"]["storefrontSearchPosition"] == 0assert data["attribute"]["choices"]["edges"][0]["node"]["name"] == nameassert data["attribute"]["choices"]["edges"][0]["node"]["slug"] == slugify(name)assert data["attribute"]["choices"]["edges"][0]["node"]["file"] is None@@ -482,9 +451,6 @@ def test_create_swatch_attribute_and_attribute_values_file_and_value_provided("values": [{"name": name, "value": "#A8A8A8", "fileUrl": file_url}],"type": AttributeTypeEnum.PRODUCT_TYPE.name,"inputType": AttributeInputTypeEnum.SWATCH.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,}}@@ -530,9 +496,6 @@ def test_create_not_swatch_attribute_provide_not_valid_data("values": [{"name": name, field: value}],"type": AttributeTypeEnum.PRODUCT_TYPE.name,"inputType": AttributeInputTypeEnum.DROPDOWN.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,}}@@ -887,10 +850,6 @@ def test_create_page_attribute_and_attribute_values(assert data["attribute"]["productTypes"]["edges"] == [], ("The attribute should not have been assigned to a product type")- assert data["attribute"]["filterableInStorefront"] is False- assert data["attribute"]["filterableInDashboard"] is False- assert data["attribute"]["availableInGrid"] is False- assert data["attribute"]["storefrontSearchPosition"] == 0# Check if the attribute values were correctly createdassert len(data["attribute"]["choices"]["edges"]) == 1@@ -939,258 +898,6 @@ def test_create_attribute_with_file_input_type_and_values(assert errors[0]["code"] == AttributeErrorCode.INVALID.name-def test_create_attribute_with_file_input_type_correct_attribute_settings(- staff_api_client,- permission_manage_product_types_and_attributes,- permission_manage_products,-):- # given- query = CREATE_ATTRIBUTE_MUTATION-- attribute_name = "Example name"- variables = {- "input": {- "name": attribute_name,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "inputType": AttributeInputTypeEnum.FILE.name,- "filterableInStorefront": False,- "filterableInDashboard": False,- "availableInGrid": False,- "storefrontSearchPosition": 0,- }- }-- # when- response = staff_api_client.post_graphql(- query,- variables,- permissions=[- permission_manage_product_types_and_attributes,- permission_manage_products,- ],- )-- # then- content = get_graphql_content(response)- assert not content["data"]["attributeCreate"]["errors"]- data = content["data"]["attributeCreate"]-- # Check if the attribute was correctly created- assert data["attribute"]["name"] == attribute_name- assert data["attribute"]["slug"] == slugify(attribute_name), (- "The default slug should be the slugified name"- )- assert data["attribute"]["productTypes"]["edges"] == [], (- "The attribute should not have been assigned to a product type"- )-- # Check if the attribute values were correctly created- assert len(data["attribute"]["choices"]["edges"]) == 0- assert data["attribute"]["type"] == AttributeTypeEnum.PRODUCT_TYPE.name- assert data["attribute"]["inputType"] == AttributeInputTypeEnum.FILE.name---def test_create_attribute_with_file_input_type_and_invalid_settings(- staff_api_client,- permission_manage_product_types_and_attributes,- permission_manage_products,-):- # given- query = CREATE_ATTRIBUTE_MUTATION-- attribute_name = "Example name"- variables = {- "input": {- "name": attribute_name,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "inputType": AttributeInputTypeEnum.FILE.name,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,- "storefrontSearchPosition": 1,- }- }-- # when- response = staff_api_client.post_graphql(- query,- variables,- permissions=[- permission_manage_product_types_and_attributes,- permission_manage_products,- ],- )-- # then- content = get_graphql_content(response)- data = content["data"]["attributeCreate"]- errors = data["errors"]-- assert not data["attribute"]- assert len(errors) == 4- assert {error["field"] for error in errors} == {- "filterableInStorefront",- "filterableInDashboard",- "availableInGrid",- "storefrontSearchPosition",- }- assert {error["code"] for error in errors} == {AttributeErrorCode.INVALID.name}--- "entity_type",- [AttributeEntityTypeEnum.PAGE.name, AttributeEntityTypeEnum.PRODUCT.name],-)-def test_create_attribute_with_reference_input_type_invalid_settings(- entity_type,- staff_api_client,- permission_manage_product_types_and_attributes,- permission_manage_products,-):- # given- query = CREATE_ATTRIBUTE_MUTATION-- attribute_name = "Example name"- variables = {- "input": {- "name": attribute_name,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "inputType": AttributeInputTypeEnum.REFERENCE.name,- "entityType": entity_type,- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,- "storefrontSearchPosition": 1,- }- }-- # when- response = staff_api_client.post_graphql(- query,- variables,- permissions=[- permission_manage_product_types_and_attributes,- permission_manage_products,- ],- )-- # then- content = get_graphql_content(response)- data = content["data"]["attributeCreate"]- errors = data["errors"]-- assert not data["attribute"]- assert len(errors) == 4- assert {error["field"] for error in errors} == {- "filterableInStorefront",- "filterableInDashboard",- "availableInGrid",- "storefrontSearchPosition",- }- assert {error["code"] for error in errors} == {AttributeErrorCode.INVALID.name}--- ("field", "value"),- [- ("filterableInStorefront", True),- ("filterableInDashboard", True),- ("availableInGrid", True),- ("storefrontSearchPosition", 4),- ],-)-def test_create_attribute_with_file_input_type_and_invalid_one_settings_value(- field,- value,- staff_api_client,- permission_manage_product_types_and_attributes,- permission_manage_products,-):- # given- query = CREATE_ATTRIBUTE_MUTATION-- attribute_name = "Example name"- variables = {- "input": {- "name": attribute_name,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "inputType": AttributeInputTypeEnum.FILE.name,- field: value,- }- }-- # when- response = staff_api_client.post_graphql(- query,- variables,- permissions=[- permission_manage_product_types_and_attributes,- permission_manage_products,- ],- )-- # then- content = get_graphql_content(response)- data = content["data"]["attributeCreate"]- errors = data["errors"]-- assert not data["attribute"]- assert len(errors) == 1- assert errors[0]["field"] == field- assert errors[0]["code"] == AttributeErrorCode.INVALID.name--- ("field", "value"),- [- ("filterableInStorefront", True),- ("filterableInDashboard", True),- ("availableInGrid", True),- ("storefrontSearchPosition", 4),- ],-)-def test_create_attribute_with_reference_input_type_invalid_one_settings_value(- field,- value,- staff_api_client,- permission_manage_product_types_and_attributes,- permission_manage_products,-):- # given- query = CREATE_ATTRIBUTE_MUTATION-- attribute_name = "Example name"- variables = {- "input": {- "name": attribute_name,- "type": AttributeTypeEnum.PRODUCT_TYPE.name,- "inputType": AttributeInputTypeEnum.REFERENCE.name,- "entityType": AttributeEntityTypeEnum.PAGE.name,- field: value,- }- }-- # when- response = staff_api_client.post_graphql(- query,- variables,- permissions=[- permission_manage_product_types_and_attributes,- permission_manage_products,- ],- )-- # then- content = get_graphql_content(response)- data = content["data"]["attributeCreate"]- errors = data["errors"]-- assert not data["attribute"]- assert len(errors) == 1- assert errors[0]["field"] == field- assert errors[0]["code"] == AttributeErrorCode.INVALID.name--@pytest.mark.parametrize("entity_type",[AttributeEntityTypeEnum.PAGE.name, AttributeEntityTypeEnum.PRODUCT.name],diff --git a/saleor/graphql/attribute/tests/mutations/test_attribute_update.py b/saleor/graphql/attribute/tests/mutations/test_attribute_update.pyindex 2c3b3537a9..247660de66 100644--- a/saleor/graphql/attribute/tests/mutations/test_attribute_update.py+++ b/saleor/graphql/attribute/tests/mutations/test_attribute_update.py@@ -362,51 +362,6 @@ def test_update_attribute_with_file_input_type_and_values(assert errors[0]["code"] == AttributeErrorCode.INVALID.name-def test_update_attribute_with_file_input_type_invalid_settings(- staff_api_client,- file_attribute_with_file_input_type_without_values,- permission_manage_product_types_and_attributes,-):- # given- query = UPDATE_ATTRIBUTE_MUTATION- attribute = file_attribute_with_file_input_type_without_values- name = "Wings name"- node_id = graphene.Node.to_global_id("Attribute", attribute.id)-- variables = {- "id": node_id,- "input": {- "name": name,- "addValues": [],- "removeValues": [],- "filterableInStorefront": True,- "filterableInDashboard": True,- "availableInGrid": True,- "storefrontSearchPosition": 3,- },- }-- # when- response = staff_api_client.post_graphql(- query, variables, permissions=[permission_manage_product_types_and_attributes]- )-- # then- content = get_graphql_content(response)- attribute.refresh_from_db()- data = content["data"]["attributeUpdate"]- errors = data["errors"]- assert not data["attribute"]- assert len(errors) == 4- assert {error["field"] for error in errors} == {- "filterableInStorefront",- "filterableInDashboard",- "availableInGrid",- "storefrontSearchPosition",- }- assert {error["code"] for error in errors} == {AttributeErrorCode.INVALID.name}--def test_update_attribute_provide_existing_value_name(staff_api_client, color_attribute, permission_manage_product_types_and_attributes):diff --git a/saleor/graphql/attribute/tests/queries/test_attribute_filter.py b/saleor/graphql/attribute/tests/queries/test_attribute_filter.pyindex 723b7b8610..48e97223f5 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_filter.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_filter.py@@ -90,55 +90,6 @@ def test_atribute_values_with_filtering_slugs(assert len(slugs) == attributes_count-def test_filter_attributes_if_filterable_in_dashboard(- api_client, color_attribute, size_attribute-):- color_attribute.filterable_in_dashboard = False- color_attribute.save(update_fields=["filterable_in_dashboard"])-- variables = {"filters": {"filterableInDashboard": True}}-- attributes = get_graphql_content(- api_client.post_graphql(ATTRIBUTES_FILTER_QUERY, variables)- )["data"]["attributes"]["edges"]-- assert len(attributes) == 1- assert attributes[0]["node"]["slug"] == "size"---def test_filter_attributes_if_available_in_grid(- api_client, color_attribute, size_attribute-):- color_attribute.available_in_grid = False- color_attribute.save(update_fields=["available_in_grid"])-- variables = {"filters": {"availableInGrid": True}}-- attributes = get_graphql_content(- api_client.post_graphql(ATTRIBUTES_FILTER_QUERY, variables)- )["data"]["attributes"]["edges"]-- assert len(attributes) == 1- assert attributes[0]["node"]["slug"] == "size"---def test_filter_attributes_if_filterable_in_storefront(- api_client, color_attribute, size_attribute-):- color_attribute.filterable_in_storefront = False- color_attribute.save(update_fields=["filterable_in_storefront"])- assert size_attribute.filterable_in_storefront is True-- variables = {"filters": {"filterableInStorefront": True}}-- attributes = get_graphql_content(- api_client.post_graphql(ATTRIBUTES_FILTER_QUERY, variables)- )["data"]["attributes"]["edges"]-- assert len(attributes) == 1- assert attributes[0]["node"]["slug"] == size_attribute.slug--def test_filter_attributes_by_global_id_list(api_client, product_type_attribute_list):global_ids = [graphene.Node.to_global_id("Attribute", attribute.pk)diff --git a/saleor/graphql/attribute/tests/queries/test_attribute_pagination.py b/saleor/graphql/attribute/tests/queries/test_attribute_pagination.pyindex 086c4d55cc..a6b1a77f05 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_pagination.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_pagination.py@@ -164,10 +164,6 @@ QUERY_ATTRIBUTES_PAGINATION = """{"field": "VALUE_REQUIRED", "direction": "ASC"},["Attr2", "Attr3", "Attr1"],),- (- {"field": "STOREFRONT_SEARCH_POSITION", "direction": "ASC"},- ["Attr3", "AttrAttr2", "AttrAttr1"],- ),],)def test_attributes_pagination_with_sorting(diff --git a/saleor/graphql/attribute/tests/queries/test_attribute_query.py b/saleor/graphql/attribute/tests/queries/test_attribute_query.pyindex 66b861b4d3..a24838f20f 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_query.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_query.py@@ -99,10 +99,6 @@ query ($id: ID!, $query: String) {}valueRequiredvisibleInStorefront- filterableInStorefront- filterableInDashboard- availableInGrid- storefrontSearchPositiontranslation(languageCode: PL) {idname@@ -151,22 +147,6 @@ def test_get_single_product_attribute_by_staff(content["data"]["attribute"]["visibleInStorefront"]== color_attribute_without_values.visible_in_storefront)- assert (- content["data"]["attribute"]["filterableInStorefront"]- == color_attribute_without_values.filterable_in_storefront- )- assert (- content["data"]["attribute"]["filterableInDashboard"]- == color_attribute_without_values.filterable_in_dashboard- )- assert (- content["data"]["attribute"]["availableInGrid"]- == color_attribute_without_values.available_in_grid- )- assert (- content["data"]["attribute"]["storefrontSearchPosition"]- == color_attribute_without_values.storefront_search_position- )def test_get_single_product_attribute_by_app(@@ -192,22 +172,6 @@ def test_get_single_product_attribute_by_app(content["data"]["attribute"]["visibleInStorefront"]== color_attribute_without_values.visible_in_storefront)- assert (- content["data"]["attribute"]["filterableInStorefront"]- == color_attribute_without_values.filterable_in_storefront- )- assert (- content["data"]["attribute"]["filterableInDashboard"]- == color_attribute_without_values.filterable_in_dashboard- )- assert (- content["data"]["attribute"]["availableInGrid"]- == color_attribute_without_values.available_in_grid- )- assert (- content["data"]["attribute"]["storefrontSearchPosition"]- == color_attribute_without_values.storefront_search_position- )def test_query_attribute_by_invalid_id(@@ -288,19 +252,6 @@ def test_get_single_product_attribute_with_file_value(assert attribute_data["slug"] == file_attribute.slugassert attribute_data["valueRequired"] == file_attribute.value_requiredassert attribute_data["visibleInStorefront"] == file_attribute.visible_in_storefront- assert (- attribute_data["filterableInStorefront"]- == file_attribute.filterable_in_storefront- )- assert (- attribute_data["filterableInDashboard"]- == file_attribute.filterable_in_dashboard- )- assert attribute_data["availableInGrid"] == file_attribute.available_in_grid- assert (- attribute_data["storefrontSearchPosition"]- == file_attribute.storefront_search_position- )assert attribute_data["choices"]["edges"] == []@@ -330,22 +281,6 @@ def test_get_single_reference_attribute_by_staff(content["data"]["attribute"]["visibleInStorefront"]== product_type_page_reference_attribute.visible_in_storefront)- assert (- content["data"]["attribute"]["filterableInStorefront"]- == product_type_page_reference_attribute.filterable_in_storefront- )- assert (- content["data"]["attribute"]["filterableInDashboard"]- == product_type_page_reference_attribute.filterable_in_dashboard- )- assert (- content["data"]["attribute"]["availableInGrid"]- == product_type_page_reference_attribute.available_in_grid- )- assert (- content["data"]["attribute"]["storefrontSearchPosition"]- == product_type_page_reference_attribute.storefront_search_position- )assert (content["data"]["attribute"]["entityType"]== product_type_page_reference_attribute.entity_type.upper()@@ -379,22 +314,6 @@ def test_get_single_numeric_attribute_by_staff(content["data"]["attribute"]["visibleInStorefront"]== numeric_attribute.visible_in_storefront)- assert (- content["data"]["attribute"]["filterableInStorefront"]- == numeric_attribute.filterable_in_storefront- )- assert (- content["data"]["attribute"]["filterableInDashboard"]- == numeric_attribute.filterable_in_dashboard- )- assert (- content["data"]["attribute"]["availableInGrid"]- == numeric_attribute.available_in_grid- )- assert (- content["data"]["attribute"]["storefrontSearchPosition"]- == numeric_attribute.storefront_search_position- )def test_get_single_swatch_attribute_by_staff(@@ -421,22 +340,6 @@ def test_get_single_swatch_attribute_by_staff(content["data"]["attribute"]["visibleInStorefront"]== swatch_attribute.visible_in_storefront)- assert (- content["data"]["attribute"]["filterableInStorefront"]- == swatch_attribute.filterable_in_storefront- )- assert (- content["data"]["attribute"]["filterableInDashboard"]- == swatch_attribute.filterable_in_dashboard- )- assert (- content["data"]["attribute"]["availableInGrid"]- == swatch_attribute.available_in_grid- )- assert (- content["data"]["attribute"]["storefrontSearchPosition"]- == swatch_attribute.storefront_search_position- )assert (len(content["data"]["attribute"]["choices"]["edges"])== swatch_attribute.values.all().count()@@ -1024,12 +927,8 @@ def test_attributes_query_ids_not_exists(user_api_client, category):@pytest.mark.parametrize(("attribute", "expected_value"),[- ("filterable_in_storefront", True),- ("filterable_in_dashboard", True),("visible_in_storefront", True),- ("available_in_grid", True),("value_required", False),- ("storefront_search_position", 0),],)def test_retrieving_the_restricted_attributes_restricted(@@ -1156,9 +1055,6 @@ def test_attributes_with_choice_flag(name=input_type.upper(),type=AttributeType.PRODUCT_TYPE,input_type=input_type,- filterable_in_storefront=True,- filterable_in_dashboard=True,- available_in_grid=True,)attribute_gql_id = graphene.Node.to_global_id("Attribute", attribute.id)diff --git a/saleor/graphql/attribute/tests/queries/test_attribute_where.py b/saleor/graphql/attribute/tests/queries/test_attribute_where.pyindex 14cbe0af7a..ca34a8a17f 100644--- a/saleor/graphql/attribute/tests/queries/test_attribute_where.py+++ b/saleor/graphql/attribute/tests/queries/test_attribute_where.py@@ -359,7 +359,6 @@ def test_attributes_filter_by_unit(type=AttributeType.PRODUCT_TYPE,input_type=AttributeInputType.NUMERIC,unit=MeasurementUnits.M,- filterable_in_dashboard=True,)attributes = [color_attribute,@@ -445,34 +444,6 @@ def test_attributes_filter_by_visible_in_storefront(assert returned_attrs == {attributes[index].slug for index in indexes}- ("value", "indexes"), [(True, [0]), (False, [1, 2]), (None, [])]-)-def test_attributes_filter_by_filterable_in_dashboard(- value, indexes, api_client, color_attribute, date_attribute, rich_text_attribute-):- # given- attributes = [color_attribute, date_attribute, rich_text_attribute]-- color_attribute.filterable_in_dashboard = True- date_attribute.filterable_in_dashboard = False- rich_text_attribute.filterable_in_dashboard = False-- Attribute.objects.bulk_update(attributes, ["filterable_in_dashboard"])-- variables = {"where": {"filterableInDashboard": value}}-- # when- response = api_client.post_graphql(ATTRIBUTES_WHERE_QUERY, variables)-- # then- data = get_graphql_content(response)- nodes = data["data"]["attributes"]["edges"]- assert len(nodes) == len(indexes)- returned_attrs = {node["node"]["slug"] for node in nodes}- assert returned_attrs == {attributes[index].slug for index in indexes}--def test_attributes_filter_attributes_in_collection_not_visible_in_listings_by_customer(user_api_client, product_list, weight_attribute, collection, channel_USD):@@ -1650,7 +1621,7 @@ def test_attributes_filter_and_where_both_used(api_client, product_type_attribut]variables = {"where": {"AND": [{"ids": ids}]},- "filter": {"filterableInDashboard": True},+ "filter": {"visibleInStorefront": True},}# whendiff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.pyindex 54b2000e38..453e0d4ec2 100644--- a/saleor/graphql/attribute/types.py+++ b/saleor/graphql/attribute/types.py@@ -72,12 +72,7 @@ from .dataloaders.reference_types import (AttributeReferencePageTypesByAttributeIdAndLimitLoader,AttributeReferenceProductTypesByAttributeIdAndLimitLoader,)-from .descriptions import (- DASHBOARD_FLAG_DEPRECATION_REASON,- STOREFRONT_FLAG_DEPRECATION_REASON,- AttributeDescriptions,- AttributeValueDescriptions,-)+from .descriptions import AttributeDescriptions, AttributeValueDescriptionsfrom .enums import AttributeEntityTypeEnum, AttributeInputTypeEnum, AttributeTypeEnumfrom .filters import (AttributeValueFilterInput,@@ -341,50 +336,6 @@ class Attribute(ChannelContextType[models.Attribute]):),required=True,)- filterable_in_storefront = graphene.Boolean(- description=(- f"{AttributeDescriptions.FILTERABLE_IN_STOREFRONT} Requires one of the "- f"following permissions: {PagePermissions.MANAGE_PAGES.name}, "- f"{PageTypePermissions.MANAGE_PAGE_TYPES_AND_ATTRIBUTES.name}, "- f"{ProductPermissions.MANAGE_PRODUCTS.name}, "- f"{ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.name}."- ),- required=True,- deprecation_reason=STOREFRONT_FLAG_DEPRECATION_REASON,- )- filterable_in_dashboard = graphene.Boolean(- description=(- f"{AttributeDescriptions.FILTERABLE_IN_DASHBOARD} Requires one of the "- f"following permissions: {PagePermissions.MANAGE_PAGES.name}, "- f"{PageTypePermissions.MANAGE_PAGE_TYPES_AND_ATTRIBUTES.name}, "- f"{ProductPermissions.MANAGE_PRODUCTS.name}, "- f"{ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.name}."- ),- required=True,- deprecation_reason=DASHBOARD_FLAG_DEPRECATION_REASON,- )- available_in_grid = graphene.Boolean(- description=(- f"{AttributeDescriptions.AVAILABLE_IN_GRID} Requires one of the following "- f"permissions: {PagePermissions.MANAGE_PAGES.name}, "- f"{PageTypePermissions.MANAGE_PAGE_TYPES_AND_ATTRIBUTES.name}, "- f"{ProductPermissions.MANAGE_PRODUCTS.name}, "- f"{ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.name}."- ),- required=True,- deprecation_reason=STOREFRONT_FLAG_DEPRECATION_REASON,- )- storefront_search_position = graphene.Int(- description=(- f"{AttributeDescriptions.STOREFRONT_SEARCH_POSITION} Requires one of the "- f"following permissions: {PagePermissions.MANAGE_PAGES.name}, "- f"{PageTypePermissions.MANAGE_PAGE_TYPES_AND_ATTRIBUTES.name}, "- f"{ProductPermissions.MANAGE_PRODUCTS.name}, "- f"{ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.name}."- ),- required=True,- deprecation_reason=STOREFRONT_FLAG_DEPRECATION_REASON,- )translation = TranslationField(AttributeTranslation,type_name="attribute",@@ -475,34 +426,6 @@ class Attribute(ChannelContextType[models.Attribute]):):return root.node.visible_in_storefront- @staticmethod- @check_attribute_required_permissions()- def resolve_filterable_in_storefront(- root: ChannelContext[models.Attribute], _info: ResolveInfo- ):- return root.node.filterable_in_storefront-- @staticmethod- @check_attribute_required_permissions()- def resolve_filterable_in_dashboard(- root: ChannelContext[models.Attribute], _info: ResolveInfo- ):- return root.node.filterable_in_dashboard-- @staticmethod- @check_attribute_required_permissions()- def resolve_storefront_search_position(- root: ChannelContext[models.Attribute], _info: ResolveInfo- ):- return root.node.storefront_search_position-- @staticmethod- @check_attribute_required_permissions()- def resolve_available_in_grid(- root: ChannelContext[models.Attribute], _info: ResolveInfo- ):- return root.node.available_in_grid-@staticmethoddef resolve_with_choices(root: ChannelContext[models.Attribute], _info: ResolveInfodiff --git a/saleor/graphql/page/tests/benchmark/test_page_type.py b/saleor/graphql/page/tests/benchmark/test_page_type.pyindex 5fb4da15ae..1a9c074cef 100644--- a/saleor/graphql/page/tests/benchmark/test_page_type.py+++ b/saleor/graphql/page/tests/benchmark/test_page_type.py@@ -37,7 +37,6 @@ def test_query_page_type(}valueRequiredvisibleInStorefront- filterableInStorefront}availableAttributes(first: 10, filter: $filters) {edges {@@ -56,7 +55,6 @@ def test_query_page_type(}valueRequiredvisibleInStorefront- filterableInStorefront}}}@@ -108,7 +106,6 @@ def test_query_page_types(}valueRequiredvisibleInStorefront- filterableInStorefront}availableAttributes(first: 10) {edges {@@ -127,7 +124,6 @@ def test_query_page_types(}valueRequiredvisibleInStorefront- filterableInStorefront}}}diff --git a/saleor/graphql/page/tests/mutations/test_page_attribute_assign.py b/saleor/graphql/page/tests/mutations/test_page_attribute_assign.pyindex f33c20efe9..6080faab18 100644--- a/saleor/graphql/page/tests/mutations/test_page_attribute_assign.py+++ b/saleor/graphql/page/tests/mutations/test_page_attribute_assign.py@@ -19,11 +19,7 @@ PAGE_ASSIGN_ATTR_QUERY = """attributes {idvisibleInStorefront- filterableInDashboard- filterableInStorefront- availableInGridvalueRequired- storefrontSearchPosition}}}diff --git a/saleor/graphql/product/tests/test_attributes.py b/saleor/graphql/product/tests/test_attributes.pyindex 4ba76a24be..8af60bd6ec 100644--- a/saleor/graphql/product/tests/test_attributes.py+++ b/saleor/graphql/product/tests/test_attributes.py@@ -534,17 +534,11 @@ PRODUCT_ASSIGN_ATTR_QUERY = """productAttributes {idvisibleInStorefront- filterableInDashboard- filterableInStorefront}variantAttributes {idvisibleInStorefront- filterableInDashboard- filterableInStorefront- availableInGridvalueRequired- storefrontSearchPosition}}}diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex e490c09b0a..6615660ce5 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -3708,26 +3708,6 @@ type Attribute implements Node & ObjectWithMetadata @doc(category: "Attributes")"""visibleInStorefront: Boolean!- """- Whether the attribute can be filtered in storefront. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.- """- filterableInStorefront: Boolean! @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """- Whether the attribute can be filtered in dashboard. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.- """- filterableInDashboard: Boolean! @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the dashboard or use `Attribute` metadata instead.")-- """- Whether the attribute can be displayed in the admin product list. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.- """- availableInGrid: Boolean! @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """- The position of the attribute in the storefront navigation (0 by default). Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.- """- storefrontSearchPosition: Int! @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-"""Returns translated attribute fields for the given language code."""translation("""A language code to return the translation for attribute."""@@ -10445,15 +10425,6 @@ input AttributeFilterInput @doc(category: "Attributes") {inCategory: IDslugs: [String!]- """Whether the attribute can be filtered in storefront."""- filterableInStorefront: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """Whether the attribute can be displayed in the admin product list."""- availableInGrid: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """Whether the attribute can be filtered in dashboard."""- filterableInDashboard: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the dashboard or use `Attribute` metadata instead.")-"""Specifies the channel by which the data should be filtered."""channel: String @deprecated(reason: "Use root-level channel argument instead.")}@@ -10480,9 +10451,6 @@ input AttributeWhereInput @doc(category: "Attributes") {valueRequired: BooleanvisibleInStorefront: Boolean- """Whether the attribute can be filtered in dashboard."""- filterableInDashboard: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the dashboard or use `Attribute` metadata instead.")-"""List of conditions that must be met."""AND: [AttributeWhereInput!]@@ -17340,20 +17308,6 @@ enum AttributeSortField @doc(category: "Attributes") {"""Sort attributes by visibility in the storefront"""VISIBLE_IN_STOREFRONT-- """Sort attributes by the filterable in storefront flag"""- FILTERABLE_IN_STOREFRONT @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """Sort attributes by the filterable in dashboard flag"""- FILTERABLE_IN_DASHBOARD @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the dashboard or use `Attribute` metadata instead.")-- """Sort attributes by their position in storefront"""- STOREFRONT_SEARCH_POSITION @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """- Sort attributes based on whether they can be displayed or not in a product grid.- """- AVAILABLE_IN_GRID @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")}"""Represents ongoing installation of app."""@@ -31936,11 +31890,7 @@ enum AttributeErrorCode @doc(category: "Attributes") {UNIQUE}-"""-Represents an input for create of attribute.--NOTE: Deprecated fields `filterableInStorefront`, `storefrontSearchPosition` and `availableInGrid` are not supported in bulk mutations: `attributeBulkCreate`, `attributeBulkUpdate`.-"""+"""Represents an input for create of attribute."""input AttributeCreateInput @doc(category: "Attributes") {"""The input type to use for entering attribute values in the dashboard."""inputType: AttributeInputTypeEnum@@ -31972,20 +31922,6 @@ input AttributeCreateInput @doc(category: "Attributes") {"""Whether the attribute should be visible or not in storefront."""visibleInStorefront: Boolean- """Whether the attribute can be filtered in storefront."""- filterableInStorefront: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """Whether the attribute can be filtered in dashboard."""- filterableInDashboard: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the dashboard or use `Attribute` metadata instead.")-- """- The position of the attribute in the storefront navigation (0 by default).- """- storefrontSearchPosition: Int @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """Whether the attribute can be displayed in the admin product list."""- availableInGrid: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-"""External ID of this attribute."""externalReference: String@@ -32059,11 +31995,7 @@ type AttributeUpdate @doc(category: "Attributes") @webhookEventsInfo(asyncEventserrors: [AttributeError!]!}-"""-Represents an input for update of attribute.--NOTE: Deprecated fields `filterableInStorefront`, `storefrontSearchPosition` and `availableInGrid` are not supported in bulk mutations: `attributeBulkCreate`, `attributeBulkUpdate`.-"""+"""Represents an input for update of attribute."""input AttributeUpdateInput @doc(category: "Attributes") {"""Name of an attribute displayed in the interface."""name: String@@ -32089,20 +32021,6 @@ input AttributeUpdateInput @doc(category: "Attributes") {"""Whether the attribute should be visible or not in storefront."""visibleInStorefront: Boolean- """Whether the attribute can be filtered in storefront."""- filterableInStorefront: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """Whether the attribute can be filtered in dashboard."""- filterableInDashboard: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the dashboard or use `Attribute` metadata instead.")-- """- The position of the attribute in the storefront navigation (0 by default).- """- storefrontSearchPosition: Int @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-- """Whether the attribute can be displayed in the admin product list."""- availableInGrid: Boolean @deprecated(reason: "This flag is not used by Saleor. Keep the logic in the storefront or use `Attribute` metadata instead.")-"""External ID of this product."""externalReference: String