Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove deprecated code from product attributes

IKarbowiakfba5c3104655
diff --git a/saleor/graphql/product/types/attributes.py b/saleor/graphql/product/types/attributes.py
index d822babc40..cea3f6b9ce 100644
--- a/saleor/graphql/product/types/attributes.py
+++ b/saleor/graphql/product/types/attributes.py
@@ -6,7 +6,6 @@ from graphene import relay
from ....core.permissions import ProductPermissions
from ....product import models
-from ....product.utils.attributes import AttributeAssignmentType
from ...core.connection import CountableDjangoObjectType
from ...core.resolvers import resolve_meta, resolve_private_meta
from ...core.types import MetadataObjectType
@@ -152,14 +151,6 @@ class SelectedAttribute(graphene.ObjectType):
description=AttributeDescriptions.NAME,
required=True,
)
- value = graphene.Field(
- AttributeValue,
- default_value=None,
- description="The value or the first value of an attribute.",
- deprecation_reason=(
- "DEPRECATED: Will be removed in Saleor 2.10, use values instead."
- ),
- )
values = graphene.List(
AttributeValue, description="Values of an attribute.", required=True
)
@@ -167,10 +158,6 @@ class SelectedAttribute(graphene.ObjectType):
class Meta:
description = "Represents a custom attribute."
- @staticmethod
- def resolve_value(root: AttributeAssignmentType, _info):
- return root.values.first()
-
class AttributeInput(graphene.InputObjectType):
slug = graphene.String(required=True, description=AttributeDescriptions.SLUG)
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 6b8303b3d1..3135550e74 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -3672,7 +3672,6 @@ type SaleUpdate {
type SelectedAttribute {
attribute: Attribute!
- value: AttributeValue @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, use values instead.")
values: [AttributeValue]!
}
diff --git a/tests/api/test_attributes.py b/tests/api/test_attributes.py
index e4b51750ee..56c66f7301 100644
--- a/tests/api/test_attributes.py
+++ b/tests/api/test_attributes.py
@@ -152,9 +152,6 @@ QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES = """
values {
slug
}
- value {
- slug
- }
}
variants {
attributes {
@@ -164,9 +161,6 @@ QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES = """
values {
slug
}
- value {
- slug
- }
}
}
}
@@ -251,11 +245,9 @@ def test_resolve_attribute_values(user_api_client, product, staff_user):
assert product_attributes[0]["attribute"]["slug"] == "color"
assert product_attributes[0]["values"][0]["slug"] == product_attribute_values[0]
- assert product_attributes[0]["value"]["slug"] == product_attribute_values[0]
assert variant_attributes[0]["attribute"]["slug"] == "size"
assert variant_attributes[0]["values"][0]["slug"] == variant_attribute_values[0]
- assert variant_attributes[0]["value"]["slug"] == variant_attribute_values[0]
def test_resolve_attribute_values_non_assigned_to_node(
@@ -308,11 +300,9 @@ def test_resolve_attribute_values_non_assigned_to_node(
assert product_attributes[0]["attribute"]["slug"] == "product"
assert product_attributes[0]["values"] == []
- assert variant_attributes[0]["value"] is None
assert variant_attributes[0]["attribute"]["slug"] == "variant"
assert variant_attributes[0]["values"] == []
- assert variant_attributes[0]["value"] is None
def test_attributes_filter_by_product_type_with_empty_value():
diff --git a/tests/api/test_variant.py b/tests/api/test_variant.py
index bd4651f3f7..0a74b54369 100644
--- a/tests/api/test_variant.py
+++ b/tests/api/test_variant.py
@@ -305,12 +305,6 @@ def test_create_product_variant_update_with_new_attributes(
}
__typename
}
- value {
- id
- name
- slug
- __typename
- }
__typename
}
}
@@ -344,8 +338,6 @@ def test_create_product_variant_update_with_new_attributes(
attributes = data["productVariant"]["attributes"]
assert len(attributes) == 1
assert attributes[0]["attribute"]["id"] == size_attribute_id
- assert attributes[0]["value"]["name"] == "XXXL"
- assert attributes[0]["value"]["slug"] == "xxxl"
def test_update_product_variant(staff_api_client, product, permission_manage_products):