Skip to content

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

Provide a reference for the rich text format (#9744)

Patryk Zawadzkif2207c408917
diff --git a/saleor/graphql/attribute/descriptions.py b/saleor/graphql/attribute/descriptions.py
index 4d4b510dca..b2d477aa79 100644
--- a/saleor/graphql/attribute/descriptions.py
+++ b/saleor/graphql/attribute/descriptions.py
@@ -1,3 +1,6 @@
+from ..core.descriptions import RICH_CONTENT
+
+
class AttributeDescriptions:
INPUT_TYPE = "The input type to use for entering attribute values in the dashboard."
ENTITY_TYPE = "The entity type which can be used as a reference."
@@ -39,7 +42,10 @@ class AttributeValueDescriptions:
"The date range that the returned values should be in. "
"In case of date/time attributes, the UTC midnight of the given date is used."
)
- RICH_TEXT = "Represents the text (JSON) of the attribute value."
+ RICH_TEXT = (
+ "Represents the text of the attribute value, includes formatting."
+ + RICH_CONTENT
+ )
BOOLEAN = "Represents the boolean value of the attribute value."
DATE = "Represents the date value of the attribute value."
DATE_TIME = "Represents the date/time value of the attribute value."
diff --git a/saleor/graphql/core/descriptions.py b/saleor/graphql/core/descriptions.py
index 0ac130c909..31b2676acd 100644
--- a/saleor/graphql/core/descriptions.py
+++ b/saleor/graphql/core/descriptions.py
@@ -26,3 +26,5 @@ CHANNEL_REQUIRED = (
"\n\nThis option requires a channel filter to work as the values can vary "
"between channels."
)
+
+RICH_CONTENT = "\n\nRich text format. For reference see https://editorjs.io/"
diff --git a/saleor/graphql/page/mutations/pages.py b/saleor/graphql/page/mutations/pages.py
index 9dc6d78f5b..4c9be70a14 100644
--- a/saleor/graphql/page/mutations/pages.py
+++ b/saleor/graphql/page/mutations/pages.py
@@ -15,7 +15,7 @@ from ....page import models
from ....page.error_codes import PageErrorCode
from ...attribute.types import AttributeValueInput
from ...attribute.utils import AttributeAssignmentMixin
-from ...core.descriptions import ADDED_IN_33, DEPRECATED_IN_3X_INPUT
+from ...core.descriptions import ADDED_IN_33, DEPRECATED_IN_3X_INPUT, RICH_CONTENT
from ...core.fields import JSONString
from ...core.mutations import ModelDeleteMutation, ModelMutation
from ...core.types import NonNullList, PageError, SeoInput
@@ -30,7 +30,7 @@ if TYPE_CHECKING:
class PageInput(graphene.InputObjectType):
slug = graphene.String(description="Page internal name.")
title = graphene.String(description="Page title.")
- content = JSONString(description="Page content in JSON format.")
+ content = JSONString(description="Page content." + RICH_CONTENT)
attributes = NonNullList(AttributeValueInput, description="List of attributes.")
is_published = graphene.Boolean(
description="Determines if page is visible in the storefront."
diff --git a/saleor/graphql/page/types.py b/saleor/graphql/page/types.py
index 036d131e49..b730c58007 100644
--- a/saleor/graphql/page/types.py
+++ b/saleor/graphql/page/types.py
@@ -12,7 +12,7 @@ from ..core.connection import (
create_connection_slice,
filter_connection_queryset,
)
-from ..core.descriptions import ADDED_IN_33, DEPRECATED_IN_3X_FIELD
+from ..core.descriptions import ADDED_IN_33, DEPRECATED_IN_3X_FIELD, RICH_CONTENT
from ..core.federation import federated_entity, resolve_federation_references
from ..core.fields import FilterConnectionField, JSONString, PermissionsField
from ..core.types import ModelObjectType, NonNullList
@@ -98,7 +98,7 @@ class Page(ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
title = graphene.String(required=True)
- content = JSONString(description="Content of the page (JSON).")
+ content = JSONString(description="Content of the page." + RICH_CONTENT)
publication_date = graphene.Date(
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} "
@@ -113,7 +113,7 @@ class Page(ModelObjectType):
page_type = graphene.Field(PageType, required=True)
created = graphene.DateTime(required=True)
content_json = JSONString(
- description="Content of the page (JSON).",
+ description="Content of the page." + RICH_CONTENT,
deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use the `content` field instead.",
required=True,
)
diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.py
index 170d6cf853..907a2997e5 100644
--- a/saleor/graphql/product/mutations/products.py
+++ b/saleor/graphql/product/mutations/products.py
@@ -46,7 +46,12 @@ from ....warehouse.management import deactivate_preorder_for_variant
from ...attribute.types import AttributeValueInput
from ...attribute.utils import AttributeAssignmentMixin, AttrValuesInput
from ...channel import ChannelContext
-from ...core.descriptions import ADDED_IN_31, DEPRECATED_IN_3X_INPUT, PREVIEW_FEATURE
+from ...core.descriptions import (
+ ADDED_IN_31,
+ DEPRECATED_IN_3X_INPUT,
+ PREVIEW_FEATURE,
+ RICH_CONTENT,
+)
from ...core.fields import JSONString
from ...core.inputs import ReorderInput
from ...core.mutations import BaseMutation, ModelDeleteMutation, ModelMutation
@@ -84,7 +89,7 @@ from ..utils import (
class CategoryInput(graphene.InputObjectType):
- description = JSONString(description="Category description (JSON).")
+ description = JSONString(description="Category description." + RICH_CONTENT)
name = graphene.String(description="Category name.")
slug = graphene.String(description="Category slug.")
seo = SeoInput(description="Search engine optimization fields.")
@@ -208,7 +213,9 @@ class CollectionInput(graphene.InputObjectType):
)
name = graphene.String(description="Name of the collection.")
slug = graphene.String(description="Slug of the collection.")
- description = JSONString(description="Description of the collection (JSON).")
+ description = JSONString(
+ description="Description of the collection." + RICH_CONTENT
+ )
background_image = Upload(description="Background image file.")
background_image_alt = graphene.String(description="Alt text for an image.")
seo = SeoInput(description="Search engine optimization fields.")
@@ -542,7 +549,7 @@ class ProductInput(graphene.InputObjectType):
description="List of IDs of collections that the product belongs to.",
name="collections",
)
- description = JSONString(description="Product description (JSON).")
+ description = JSONString(description="Product description." + RICH_CONTENT)
name = graphene.String(description="Product name.")
slug = graphene.String(description="Product slug.")
tax_code = graphene.String(description="Tax rate for enabled tax gateway.")
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.py
index 822a7a2178..c9d4e1e87e 100644
--- a/saleor/graphql/product/types/products.py
+++ b/saleor/graphql/product/types/products.py
@@ -51,6 +51,7 @@ from ...core.descriptions import (
DEPRECATED_IN_3X_FIELD,
DEPRECATED_IN_3X_INPUT,
PREVIEW_FEATURE,
+ RICH_CONTENT,
)
from ...core.enums import ReportingPeriod
from ...core.federation import federated_entity, resolve_federation_references
@@ -743,7 +744,7 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String(required=True)
- description = JSONString()
+ description = JSONString(description="Description of the product." + RICH_CONTENT)
product_type = graphene.Field(lambda: ProductType, required=True)
slug = graphene.String(required=True)
category = graphene.Field(lambda: Category)
@@ -760,7 +761,7 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):
),
)
description_json = JSONString(
- description="Description of the product (JSON).",
+ description="Description of the product." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -1434,7 +1435,9 @@ class Collection(ChannelContextTypeWithMetadata, ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String(required=True)
- description = JSONString()
+ description = JSONString(
+ description="Description of the collection." + RICH_CONTENT
+ )
slug = graphene.String(required=True)
channel = graphene.String(
description=(
@@ -1443,7 +1446,7 @@ class Collection(ChannelContextTypeWithMetadata, ModelObjectType):
),
)
description_json = JSONString(
- description="Description of the collection (JSON).",
+ description="Description of the collection." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -1551,12 +1554,12 @@ class Category(ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String(required=True)
- description = JSONString()
+ description = JSONString(description="Description of the category." + RICH_CONTENT)
slug = graphene.String(required=True)
parent = graphene.Field(lambda: Category)
level = graphene.Int(required=True)
description_json = JSONString(
- description="Description of the category (JSON).",
+ description="Description of the category." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 2a65a3c792..e8de1cdd93 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -2580,7 +2580,11 @@ type ShippingMethodType implements Node & ObjectWithMetadata {
"""Shipping method name."""
name: String!
- """Shipping method description."""
+ """
+ Shipping method description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Type of the shipping method."""
@@ -2654,6 +2658,12 @@ type ShippingMethodTranslation implements Node {
"""Translation language."""
language: LanguageDisplay!
name: String
+
+ """
+ Translated description of the shipping method.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
}
@@ -3570,6 +3580,12 @@ type Product implements Node & ObjectWithMetadata {
seoTitle: String
seoDescription: String
name: String!
+
+ """
+ Description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
productType: ProductType!
slug: String!
@@ -3586,7 +3602,11 @@ type Product implements Node & ObjectWithMetadata {
"""
channel: String
- """Description of the product (JSON)."""
+ """
+ Description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
"""The main thumbnail for a product."""
@@ -4090,7 +4110,11 @@ type AttributeValue implements Node {
"""Represents file URL and content type (if attribute value is a file)."""
file: File
- """Represents the text (JSON) of the attribute value."""
+ """
+ Represents the text of the attribute value, includes formatting.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
richText: JSONString
"""Represents the boolean value of the attribute value."""
@@ -4109,6 +4133,12 @@ type AttributeValueTranslation implements Node {
"""Translation language."""
language: LanguageDisplay!
name: String!
+
+ """
+ Attribute value.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
richText: JSONString
}
@@ -4295,12 +4325,22 @@ type Category implements Node & ObjectWithMetadata {
seoTitle: String
seoDescription: String
name: String!
+
+ """
+ Description of the category.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
slug: String!
parent: Category
level: Int!
- """Description of the category (JSON)."""
+ """
+ Description of the category.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
"""List of ancestors of the category."""
@@ -4398,9 +4438,19 @@ type CategoryTranslation implements Node {
seoTitle: String
seoDescription: String
name: String
+
+ """
+ Translated description of the category.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
- """Translated description of the product (JSON)."""
+ """
+ Translated description of the category.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
}
@@ -5264,6 +5314,12 @@ type Collection implements Node & ObjectWithMetadata {
seoTitle: String
seoDescription: String
name: String!
+
+ """
+ Description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
slug: String!
@@ -5272,7 +5328,11 @@ type Collection implements Node & ObjectWithMetadata {
"""
channel: String
- """Description of the collection (JSON)."""
+ """
+ Description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
"""List of products in this collection."""
@@ -5500,9 +5560,19 @@ type CollectionTranslation implements Node {
seoTitle: String
seoDescription: String
name: String
+
+ """
+ Translated description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
- """Translated description of the product (JSON)."""
+ """
+ Translated description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
}
@@ -5529,9 +5599,19 @@ type ProductTranslation implements Node {
seoTitle: String
seoDescription: String
name: String
+
+ """
+ Translated description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
- """Translated description of the product (JSON)."""
+ """
+ Translated description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
}
@@ -5596,9 +5676,19 @@ type ProductTranslatableContent implements Node {
seoTitle: String
seoDescription: String
name: String!
+
+ """
+ Description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
- """Description of the product (JSON)."""
+ """
+ Description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
"""Returns translated product fields for the given language code."""
@@ -5617,6 +5707,12 @@ type ProductTranslatableContent implements Node {
type AttributeValueTranslatableContent implements Node {
id: ID!
name: String!
+
+ """
+ Attribute value.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
richText: JSONString
"""Returns translated attribute value fields for the given language code."""
@@ -5634,9 +5730,19 @@ type CollectionTranslatableContent implements Node {
seoTitle: String
seoDescription: String
name: String!
+
+ """
+ Description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
- """Description of the collection (JSON)."""
+ """
+ Description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
"""Returns translated collection fields for the given language code."""
@@ -5654,9 +5760,19 @@ type CategoryTranslatableContent implements Node {
seoTitle: String
seoDescription: String
name: String!
+
+ """
+ Description of the category.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
- """Description of the category (JSON)."""
+ """
+ Description of the category.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
descriptionJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `description` field instead.")
"""Returns translated category fields for the given language code."""
@@ -5705,9 +5821,19 @@ type PageTranslatableContent implements Node {
seoTitle: String
seoDescription: String
title: String!
+
+ """
+ Content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
content: JSONString
- """Content of the page (JSON)."""
+ """
+ Content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
contentJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `content` field instead.")
"""Returns translated page fields for the given language code."""
@@ -5733,9 +5859,19 @@ type PageTranslation implements Node {
seoTitle: String
seoDescription: String
title: String
+
+ """
+ Translated content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
content: JSONString
- """Translated description of the page (JSON)."""
+ """
+ Translated description of the page.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
contentJson: JSONString @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `content` field instead.")
}
@@ -5794,7 +5930,11 @@ type Page implements Node & ObjectWithMetadata {
seoDescription: String
title: String!
- """Content of the page (JSON)."""
+ """
+ Content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
content: JSONString
publicationDate: Date @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `publishedAt` field to fetch the publication date.")
@@ -5809,7 +5949,11 @@ type Page implements Node & ObjectWithMetadata {
pageType: PageType!
created: DateTime!
- """Content of the page (JSON)."""
+ """
+ Content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
contentJson: JSONString! @deprecated(reason: "This field will be removed in Saleor 4.0. Use the `content` field instead.")
"""Returns translated page fields for the given language code."""
@@ -5911,6 +6055,12 @@ type PageType implements Node & ObjectWithMetadata {
type ShippingMethodTranslatableContent implements Node {
id: ID!
name: String!
+
+ """
+ Description of the shipping method.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Returns translated shipping method fields for the given language code."""
@@ -6856,7 +7006,11 @@ type ShippingMethod implements Node & ObjectWithMetadata {
"""Shipping method name."""
name: String!
- """Shipping method description (JSON)."""
+ """
+ Shipping method description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Maximum delivery days for this shipping method."""
@@ -14091,7 +14245,11 @@ type ShippingPriceTranslate {
input ShippingPriceTranslationInput {
name: String
- """Translated shipping method description (JSON)."""
+ """
+ Translated shipping method description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
}
@@ -14343,7 +14501,11 @@ type CategoryCreate {
}
input CategoryInput {
- """Category description (JSON)."""
+ """
+ Category description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Category name."""
@@ -14424,6 +14586,12 @@ input TranslationInput {
seoTitle: String
seoDescription: String
name: String
+
+ """
+ Translated description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
}
@@ -14487,7 +14655,11 @@ input CollectionCreateInput {
"""Slug of the collection."""
slug: String
- """Description of the collection (JSON)."""
+ """
+ Description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Background image file."""
@@ -14588,7 +14760,11 @@ input CollectionInput {
"""Slug of the collection."""
slug: String
- """Description of the collection (JSON)."""
+ """
+ Description of the collection.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Background image file."""
@@ -14707,7 +14883,11 @@ input ProductCreateInput {
"""List of IDs of collections that the product belongs to."""
collections: [ID!]
- """Product description (JSON)."""
+ """
+ Product description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Product name."""
@@ -14810,7 +14990,11 @@ input ProductInput {
"""List of IDs of collections that the product belongs to."""
collections: [ID!]
- """Product description (JSON)."""
+ """
+ Product description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
description: JSONString
"""Product name."""
@@ -16027,7 +16211,11 @@ input PageCreateInput {
"""Page title."""
title: String
- """Page content in JSON format."""
+ """
+ Page content.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
content: JSONString
"""List of attributes."""
@@ -16110,7 +16298,11 @@ input PageInput {
"""Page title."""
title: String
- """Page content in JSON format."""
+ """
+ Page content.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
content: JSONString
"""List of attributes."""
@@ -16152,6 +16344,12 @@ input PageTranslationInput {
seoTitle: String
seoDescription: String
title: String
+
+ """
+ Translated page content.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
content: JSONString
}
@@ -18857,7 +19055,11 @@ input AttributeValueCreateInput {
"""
value: String
- """Represents the text (JSON) of the attribute value."""
+ """
+ Represents the text of the attribute value, includes formatting.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
richText: JSONString
"""URL of the file attribute. Every time, a new value is created."""
@@ -18938,7 +19140,11 @@ input AttributeValueUpdateInput {
"""
value: String
- """Represents the text (JSON) of the attribute value."""
+ """
+ Represents the text of the attribute value, includes formatting.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
richText: JSONString
"""URL of the file attribute. Every time, a new value is created."""
@@ -19038,6 +19244,12 @@ type AttributeValueTranslate {
input AttributeValueTranslationInput {
name: String
+
+ """
+ Translated text.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
richText: JSONString
}
diff --git a/saleor/graphql/shipping/types.py b/saleor/graphql/shipping/types.py
index eb9e6384bf..010e13403c 100644
--- a/saleor/graphql/shipping/types.py
+++ b/saleor/graphql/shipping/types.py
@@ -17,7 +17,7 @@ from ..channel.types import (
ChannelContextTypeWithMetadataForObjectType,
)
from ..core.connection import CountableConnection, create_connection_slice
-from ..core.descriptions import DEPRECATED_IN_3X_FIELD
+from ..core.descriptions import DEPRECATED_IN_3X_FIELD, RICH_CONTENT
from ..core.fields import ConnectionField, JSONString, PermissionsField
from ..core.types import (
CountryDisplay,
@@ -82,7 +82,7 @@ class ShippingMethodType(ChannelContextTypeWithMetadataForObjectType):
id = graphene.ID(required=True, description="Shipping method ID.")
name = graphene.String(required=True, description="Shipping method name.")
- description = JSONString(description="Shipping method description.")
+ description = JSONString(description="Shipping method description." + RICH_CONTENT)
type = ShippingMethodTypeEnum(description="Type of the shipping method.")
translation = TranslationField(
ShippingMethodTranslation,
@@ -305,7 +305,7 @@ class ShippingMethod(graphene.ObjectType):
deprecation_reason=DEPRECATED_IN_3X_FIELD,
)
name = graphene.String(required=True, description="Shipping method name.")
- description = JSONString(description="Shipping method description (JSON).")
+ description = JSONString(description="Shipping method description." + RICH_CONTENT)
maximum_delivery_days = graphene.Int(
description="Maximum delivery days for this shipping method."
)
diff --git a/saleor/graphql/translations/mutations.py b/saleor/graphql/translations/mutations.py
index 0129c2e24b..89acc5907d 100644
--- a/saleor/graphql/translations/mutations.py
+++ b/saleor/graphql/translations/mutations.py
@@ -15,6 +15,7 @@ from ...shipping import models as shipping_models
from ...site.models import SiteSettings
from ..attribute.types import Attribute, AttributeValue
from ..channel import ChannelContext
+from ..core.descriptions import RICH_CONTENT
from ..core.enums import LanguageCodeEnum, TranslationErrorCode
from ..core.fields import JSONString
from ..core.mutations import BaseMutation, ModelMutation
@@ -135,7 +136,7 @@ class NameTranslationInput(graphene.InputObjectType):
class AttributeValueTranslationInput(NameTranslationInput):
- rich_text = JSONString()
+ rich_text = JSONString(description="Translated text." + RICH_CONTENT)
class SeoTranslationInput(graphene.InputObjectType):
@@ -144,12 +145,12 @@ class SeoTranslationInput(graphene.InputObjectType):
class TranslationInput(NameTranslationInput, SeoTranslationInput):
- description = JSONString()
+ description = JSONString(description="Translated description." + RICH_CONTENT)
class ShippingPriceTranslationInput(NameTranslationInput):
description = JSONString(
- description="Translated shipping method description (JSON)."
+ description="Translated shipping method description." + RICH_CONTENT
)
@@ -438,7 +439,7 @@ class MenuItemTranslate(BaseTranslateMutation):
class PageTranslationInput(SeoTranslationInput):
title = graphene.String()
- content = JSONString()
+ content = JSONString(description="Translated page content." + RICH_CONTENT)
class PageTranslate(BaseTranslateMutation):
diff --git a/saleor/graphql/translations/types.py b/saleor/graphql/translations/types.py
index 9cec603b7e..ace57b6cb5 100644
--- a/saleor/graphql/translations/types.py
+++ b/saleor/graphql/translations/types.py
@@ -15,7 +15,7 @@ from ...product import models as product_models
from ...shipping import models as shipping_models
from ...site import models as site_models
from ..channel import ChannelContext
-from ..core.descriptions import DEPRECATED_IN_3X_FIELD
+from ..core.descriptions import DEPRECATED_IN_3X_FIELD, RICH_CONTENT
from ..core.enums import LanguageCodeEnum
from ..core.fields import JSONString, PermissionsField
from ..core.types import LanguageDisplay, ModelObjectType, NonNullList
@@ -68,7 +68,7 @@ class BaseTranslationType(ModelObjectType):
class AttributeValueTranslation(BaseTranslationType):
id = graphene.GlobalID(required=True)
name = graphene.String(required=True)
- rich_text = JSONString()
+ rich_text = JSONString(description="Attribute value." + RICH_CONTENT)
class Meta:
model = attribute_models.AttributeValueTranslation
@@ -78,7 +78,7 @@ class AttributeValueTranslation(BaseTranslationType):
class AttributeValueTranslatableContent(ModelObjectType):
id = graphene.GlobalID(required=True)
name = graphene.String(required=True)
- rich_text = JSONString()
+ rich_text = JSONString(description="Attribute value." + RICH_CONTENT)
translation = TranslationField(
AttributeValueTranslation, type_name="attribute value"
)
@@ -181,9 +181,11 @@ class ProductTranslation(BaseTranslationType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String()
- description = JSONString()
+ description = JSONString(
+ description="Translated description of the product." + RICH_CONTENT
+ )
description_json = JSONString(
- description="Translated description of the product (JSON).",
+ description="Translated description of the product." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -204,9 +206,9 @@ class ProductTranslatableContent(ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String(required=True)
- description = JSONString()
+ description = JSONString(description="Description of the product." + RICH_CONTENT)
description_json = JSONString(
- description="Description of the product (JSON).",
+ description="Description of the product." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -252,9 +254,11 @@ class CollectionTranslation(BaseTranslationType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String()
- description = JSONString()
+ description = JSONString(
+ description="Translated description of the collection." + RICH_CONTENT
+ )
description_json = JSONString(
- description="Translated description of the product (JSON).",
+ description="Translated description of the collection." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -275,9 +279,11 @@ class CollectionTranslatableContent(ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String(required=True)
- description = JSONString()
+ description = JSONString(
+ description="Description of the collection." + RICH_CONTENT
+ )
description_json = JSONString(
- description="Description of the collection (JSON).",
+ description="Description of the collection." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -313,9 +319,11 @@ class CategoryTranslation(BaseTranslationType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String()
- description = JSONString()
+ description = JSONString(
+ description="Translated description of the category." + RICH_CONTENT
+ )
description_json = JSONString(
- description="Translated description of the product (JSON).",
+ description="Translated description of the category." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -336,9 +344,9 @@ class CategoryTranslatableContent(ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
name = graphene.String(required=True)
- description = JSONString()
+ description = JSONString(description="Description of the category." + RICH_CONTENT)
description_json = JSONString(
- description="Description of the category (JSON).",
+ description="Description of the category." + RICH_CONTENT,
deprecation_reason=(
f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."
),
@@ -371,9 +379,9 @@ class PageTranslation(BaseTranslationType):
seo_title = graphene.String()
seo_description = graphene.String()
title = graphene.String()
- content = JSONString()
+ content = JSONString(description="Translated content of the page." + RICH_CONTENT)
content_json = JSONString(
- description="Translated description of the page (JSON).",
+ description="Translated description of the page." + RICH_CONTENT,
deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use the `content` field instead.",
)
@@ -392,9 +400,9 @@ class PageTranslatableContent(ModelObjectType):
seo_title = graphene.String()
seo_description = graphene.String()
title = graphene.String(required=True)
- content = JSONString()
+ content = JSONString(description="Content of the page." + RICH_CONTENT)
content_json = JSONString(
- description="Content of the page (JSON).",
+ description="Content of the page." + RICH_CONTENT,
deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use the `content` field instead.",
)
translation = TranslationField(PageTranslation, type_name="page")
@@ -555,7 +563,9 @@ class MenuItemTranslatableContent(ModelObjectType):
class ShippingMethodTranslation(BaseTranslationType):
id = graphene.GlobalID(required=True)
name = graphene.String()
- description = JSONString()
+ description = JSONString(
+ description="Translated description of the shipping method." + RICH_CONTENT
+ )
class Meta:
model = shipping_models.ShippingMethodTranslation
@@ -565,7 +575,9 @@ class ShippingMethodTranslation(BaseTranslationType):
class ShippingMethodTranslatableContent(ModelObjectType):
id = graphene.GlobalID(required=True)
name = graphene.String(required=True)
- description = JSONString()
+ description = JSONString(
+ description="Description of the shipping method." + RICH_CONTENT
+ )
translation = TranslationField(
ShippingMethodTranslation, type_name="shipping method"
)