Skip to content

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

Change output of translations query

fowczarek25e3c1600ad5
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index c41654fad7..a5d6b4f0ac 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -4111,8 +4111,6 @@ enum TransactionKind {
CONFIRM
}
-union TranslatableItem = Product | Category | Collection | Attribute | AttributeValue | ProductVariant | Page | ShippingMethod | Sale | Voucher | MenuItem
-
type TranslatableItemConnection {
pageInfo: PageInfo!
edges: [TranslatableItemEdge!]!
@@ -4120,7 +4118,7 @@ type TranslatableItemConnection {
}
type TranslatableItemEdge {
- node: TranslatableItem!
+ node: DefaultTranslationItem!
cursor: String!
}
diff --git a/saleor/graphql/translations/schema.py b/saleor/graphql/translations/schema.py
index 7ac99d8f18..b4de28f1fa 100644
--- a/saleor/graphql/translations/schema.py
+++ b/saleor/graphql/translations/schema.py
@@ -72,7 +72,7 @@ class DefaultTranslationItem(graphene.Union):
class TranslatableItemConnection(CountableConnection):
class Meta:
- node = TranslatableItem
+ node = DefaultTranslationItem
class TranslatableKinds(graphene.Enum):
@@ -90,7 +90,6 @@ class TranslatableKinds(graphene.Enum):
class TranslationQueries(graphene.ObjectType):
- # TODO We nead to change output of this query to new types. Issue #4957
translations = BaseConnectionField(
TranslatableItemConnection,
description="Returns a list of all translatable items of a given kind.",
diff --git a/tests/api/test_translations.py b/tests/api/test_translations.py
index 373b6246c1..07d5e90ffd 100644
--- a/tests/api/test_translations.py
+++ b/tests/api/test_translations.py
@@ -1295,17 +1295,17 @@ def test_shop_update_translation(
@pytest.mark.parametrize(
"kind, expected_typename",
[
- (TranslatableKinds.PRODUCT, "Product"),
- (TranslatableKinds.COLLECTION, "Collection"),
- (TranslatableKinds.CATEGORY, "Category"),
- (TranslatableKinds.PAGE, "Page"),
- (TranslatableKinds.SHIPPING_METHOD, "ShippingMethod"),
- (TranslatableKinds.VOUCHER, "Voucher"),
- (TranslatableKinds.SALE, "Sale"),
- (TranslatableKinds.ATTRIBUTE, "Attribute"),
- (TranslatableKinds.ATTRIBUTE_VALUE, "AttributeValue"),
- (TranslatableKinds.VARIANT, "ProductVariant"),
- (TranslatableKinds.MENU_ITEM, "MenuItem"),
+ (TranslatableKinds.PRODUCT, "ProductTranslatableContent"),
+ (TranslatableKinds.COLLECTION, "CollectionTranslatableContent"),
+ (TranslatableKinds.CATEGORY, "CategoryTranslatableContent"),
+ (TranslatableKinds.PAGE, "PageTranslatableContent"),
+ (TranslatableKinds.SHIPPING_METHOD, "ShippingMethodTranslatableContent"),
+ (TranslatableKinds.VOUCHER, "VoucherTranslatableContent"),
+ (TranslatableKinds.SALE, "SaleTranslatableContent"),
+ (TranslatableKinds.ATTRIBUTE, "AttributeTranslatableContent"),
+ (TranslatableKinds.ATTRIBUTE_VALUE, "AttributeValueTranslatableContent"),
+ (TranslatableKinds.VARIANT, "ProductVariantTranslatableContent"),
+ (TranslatableKinds.MENU_ITEM, "MenuItemTranslatableContent"),
],
)
def test_translations_query(
@@ -1346,7 +1346,7 @@ def test_translations_query_inline_fragment(user_api_client, product):
translations(kind: PRODUCT, first: 1) {
edges {
node {
- ... on Product {
+ ... on ProductTranslatableContent {
name
translation(languageCode: PL) {
name