Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Override graphene.JSONString to have more meaningful message in error message (#9171)
L3str4nge2a0c5a71a483
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 77360bc127..087967ea0b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,7 @@ All notable, unreleased changes to this project will be documented in this file.- Add possibility for plugins to execute code before each mutation - #9193 by @NyanKiyoshi- Add support for hiding plugins - #9219 by @NyanKiyoshi- Remove `graphene-federation` dependency - #9184 by @rafalp+- Override graphene.JSONString to have more meaningful error message #9171 by @L3str4nge# 3.1.0diff --git a/saleor/graphql/account/mutations/authentication.py b/saleor/graphql/account/mutations/authentication.pyindex 693a5f4787..363c086545 100644--- a/saleor/graphql/account/mutations/authentication.py+++ b/saleor/graphql/account/mutations/authentication.py@@ -21,6 +21,7 @@ from ....core.jwt import (jwt_decode,)from ....core.permissions import get_permissions_from_names+from ...core.fields import JSONStringfrom ...core.mutations import BaseMutationfrom ...core.types.common import AccountErrorfrom ..types import User@@ -313,7 +314,7 @@ class DeactivateAllUserTokens(BaseMutation):class ExternalAuthenticationUrl(BaseMutation):"""Prepare external authentication url for user by a custom plugin."""- authentication_data = graphene.JSONString(+ authentication_data = JSONString(description="The data returned by authentication plugin.")@@ -321,7 +322,7 @@ class ExternalAuthenticationUrl(BaseMutation):plugin_id = graphene.String(description="The ID of the authentication plugin.", required=True)- input = graphene.JSONString(+ input = JSONString(required=True,description=("The data required by plugin to create external authentication url."@@ -362,7 +363,7 @@ class ExternalObtainAccessTokens(BaseMutation):plugin_id = graphene.String(description="The ID of the authentication plugin.", required=True)- input = graphene.JSONString(+ input = JSONString(required=True,description="The data required by plugin to create authentication data.",)@@ -412,7 +413,7 @@ class ExternalRefresh(BaseMutation):plugin_id = graphene.String(description="The ID of the authentication plugin.", required=True)- input = graphene.JSONString(+ input = JSONString(required=True,description="The data required by plugin to proceed the refresh process.",)@@ -446,15 +447,13 @@ class ExternalRefresh(BaseMutation):class ExternalLogout(BaseMutation):"""Logout user by a custom plugin."""- logout_data = graphene.JSONString(- description="The data returned by authentication plugin."- )+ logout_data = JSONString(description="The data returned by authentication plugin.")class Arguments:plugin_id = graphene.String(description="The ID of the authentication plugin.", required=True)- input = graphene.JSONString(+ input = JSONString(required=True,description="The data required by plugin to proceed the logout process.",)@@ -480,13 +479,13 @@ class ExternalVerify(BaseMutation):default_value=False,description="Determine if authentication data is valid or not.",)- verify_data = graphene.JSONString(description="External data.")+ verify_data = JSONString(description="External data.")class Arguments:plugin_id = graphene.String(description="The ID of the authentication plugin.", required=True)- input = graphene.JSONString(+ input = JSONString(required=True,description="The data required by plugin to proceed the verification.",)diff --git a/saleor/graphql/attribute/mutations.py b/saleor/graphql/attribute/mutations.pyindex 6dd884b4ad..37df4e7672 100644--- a/saleor/graphql/attribute/mutations.py+++ b/saleor/graphql/attribute/mutations.py@@ -19,6 +19,7 @@ from ...core.utils import generate_unique_slugfrom ...product import models as product_modelsfrom ...product.search import update_products_search_documentfrom ..core.enums import MeasurementUnitsEnum+from ..core.fields import JSONStringfrom ..core.inputs import ReorderInputfrom ..core.mutations import BaseMutation, ModelDeleteMutation, ModelMutationfrom ..core.types.common import AttributeError@@ -190,7 +191,7 @@ class BaseReorderAttributeValuesMutation(BaseMutation):class AttributeValueInput(graphene.InputObjectType):value = graphene.String(description=AttributeValueDescriptions.VALUE)- rich_text = graphene.JSONString(description=AttributeValueDescriptions.RICH_TEXT)+ rich_text = JSONString(description=AttributeValueDescriptions.RICH_TEXT)file_url = graphene.String(required=False,description="URL of the file attribute. Every time, a new value is created.",diff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.pyindex 3d39122598..1dc69075c9 100644--- a/saleor/graphql/attribute/types.py+++ b/saleor/graphql/attribute/types.py@@ -16,7 +16,7 @@ from ..core.connection import ()from ..core.descriptions import ADDED_IN_31from ..core.enums import MeasurementUnitsEnum-from ..core.fields import ConnectionField, FilterConnectionField+from ..core.fields import ConnectionField, FilterConnectionField, JSONStringfrom ..core.types import File, ModelObjectTypefrom ..core.types.common import DateRangeInput, DateTimeRangeInput, IntRangeInputfrom ..decorators import check_attribute_required_permissions@@ -46,7 +46,7 @@ class AttributeValue(ModelObjectType):file = graphene.Field(File, description=AttributeValueDescriptions.FILE, required=False)- rich_text = graphene.JSONString(+ rich_text = JSONString(description=AttributeValueDescriptions.RICH_TEXT, required=False)boolean = graphene.Boolean(@@ -347,9 +347,7 @@ class AttributeValueInput(graphene.InputObjectType):description="List of entity IDs that will be used as references.",required=False,)- rich_text = graphene.JSONString(- required=False, description="Text content in JSON format."- )+ rich_text = JSONString(required=False, description="Text content in JSON format.")boolean = graphene.Boolean(required=False, description=AttributeValueDescriptions.BOOLEAN)diff --git a/saleor/graphql/checkout/mutations.py b/saleor/graphql/checkout/mutations.pyindex f6bfe58a50..54cf78d99a 100644--- a/saleor/graphql/checkout/mutations.py+++ b/saleor/graphql/checkout/mutations.py@@ -58,6 +58,7 @@ from ..core.descriptions import (PREVIEW_FEATURE,)from ..core.enums import LanguageCodeEnum+from ..core.fields import JSONStringfrom ..core.mutations import BaseMutation, ModelMutationfrom ..core.scalars import UUIDfrom ..core.types.common import CheckoutError@@ -1640,7 +1641,7 @@ class CheckoutComplete(BaseMutation):" before checkout is complete."),)- confirmation_data = graphene.JSONString(+ confirmation_data = JSONString(required=False,description=("Confirmation data used to process additional authorization steps."@@ -1669,7 +1670,7 @@ class CheckoutComplete(BaseMutation):"see the order details. URL in RFC 1808 format."),)- payment_data = graphene.JSONString(+ payment_data = JSONString(required=False,description=("Client-side generated data required to finalize the payment."diff --git a/saleor/graphql/core/fields.py b/saleor/graphql/core/fields.pyindex ecd071999b..1766452d40 100644--- a/saleor/graphql/core/fields.py+++ b/saleor/graphql/core/fields.py@@ -1,7 +1,9 @@from functools import wraps+from json import JSONDecodeErrorimport graphenefrom graphene.relay import Connection, is_node+from graphql import GraphQLErrorfrom .connection import FILTERS_NAME, FILTERSET_CLASS@@ -75,3 +77,12 @@ class FilterConnectionField(ConnectionField):return wrapped_resolver(obj, info, **kwargs)return new_resolver+++class JSONString(graphene.JSONString):+ @staticmethod+ def parse_literal(node):+ try:+ graphene.JSONString.parse_literal(node)+ except JSONDecodeError:+ raise GraphQLError(f"{str(node.value)[:20]}... is not a valid JSONString")diff --git a/saleor/graphql/notifications/mutations/external_notification_trigger.py b/saleor/graphql/notifications/mutations/external_notification_trigger.pyindex 327617ca23..6b0089f973 100644--- a/saleor/graphql/notifications/mutations/external_notification_trigger.py+++ b/saleor/graphql/notifications/mutations/external_notification_trigger.py@@ -14,6 +14,7 @@ from ....core.notification.validation import (from ....graphql.core.types.common import ExternalNotificationErrorfrom ....graphql.notifications.error_codes import ExternalNotificationErrorCodesfrom ...core.descriptions import ADDED_IN_31+from ...core.fields import JSONStringfrom ...core.mutations import BaseMutation@@ -26,7 +27,7 @@ class ExternalNotificationTriggerInput(graphene.InputObjectType):"included in the notification payload."),)- extra_payload = graphene.JSONString(+ extra_payload = JSONString(description=("Additional payload that will be merged with ""the one based on the bussines object ID."diff --git a/saleor/graphql/page/mutations/pages.py b/saleor/graphql/page/mutations/pages.pyindex 96946a5b2d..c717dafa2f 100644--- a/saleor/graphql/page/mutations/pages.py+++ b/saleor/graphql/page/mutations/pages.py@@ -13,6 +13,7 @@ from ....page import modelsfrom ....page.error_codes import PageErrorCodefrom ...attribute.types import AttributeValueInputfrom ...attribute.utils import AttributeAssignmentMixin+from ...core.fields import JSONStringfrom ...core.mutations import ModelDeleteMutation, ModelMutationfrom ...core.types.common import PageError, SeoInputfrom ...core.utils import clean_seo_fields, validate_slug_and_generate_if_needed@@ -26,7 +27,7 @@ if TYPE_CHECKING:class PageInput(graphene.InputObjectType):slug = graphene.String(description="Page internal name.")title = graphene.String(description="Page title.")- content = graphene.JSONString(description="Page content in JSON format.")+ content = JSONString(description="Page content in JSON format.")attributes = graphene.List(graphene.NonNull(AttributeValueInput), description="List of attributes.")diff --git a/saleor/graphql/page/types.py b/saleor/graphql/page/types.pyindex 384a457578..08d3a6cfcc 100644--- a/saleor/graphql/page/types.py+++ b/saleor/graphql/page/types.py@@ -14,7 +14,7 @@ from ..core.connection import ()from ..core.descriptions import DEPRECATED_IN_3X_FIELDfrom ..core.federation import federated_entity, resolve_federation_references-from ..core.fields import FilterConnectionField+from ..core.fields import FilterConnectionField, JSONStringfrom ..core.types import ModelObjectTypefrom ..decorators import permission_requiredfrom ..meta.types import ObjectWithMetadata@@ -92,13 +92,13 @@ class Page(ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()title = graphene.String(required=True)- content = graphene.JSONString(description="Content of the page (JSON).")+ content = JSONString(description="Content of the page (JSON).")publication_date = graphene.Date()is_published = graphene.Boolean(required=True)slug = graphene.String(required=True)page_type = graphene.Field(PageType, required=True)created = graphene.DateTime(required=True)- content_json = graphene.JSONString(+ content_json = JSONString(description="Content of the page (JSON).",deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use the `content` field instead.",required=True,diff --git a/saleor/graphql/payment/mutations.py b/saleor/graphql/payment/mutations.pyindex 9fe6cbc02a..a4a0a6ca5c 100644--- a/saleor/graphql/payment/mutations.py+++ b/saleor/graphql/payment/mutations.py@@ -21,6 +21,7 @@ from ..checkout.mutations import get_checkout_by_tokenfrom ..checkout.types import Checkoutfrom ..core.descriptions import ADDED_IN_31, DEPRECATED_IN_3X_INPUTfrom ..core.enums import to_enum+from ..core.fields import JSONStringfrom ..core.mutations import BaseMutationfrom ..core.scalars import UUID, PositiveDecimalfrom ..core.types import common as common_types@@ -403,7 +404,7 @@ class PaymentInitialize(BaseMutation):channel = graphene.String(description="Slug of a channel for which the data should be returned.",)- payment_data = graphene.JSONString(+ payment_data = JSONString(required=False,description=("Client-side generated data required to initialize the payment."@@ -490,7 +491,7 @@ class PaymentCheckBalanceInput(graphene.InputObjectType):class PaymentCheckBalance(BaseMutation):- data = graphene.types.JSONString(description="Response from the gateway.")+ data = JSONString(description="Response from the gateway.")class Arguments:input = PaymentCheckBalanceInput(diff --git a/saleor/graphql/payment/types.py b/saleor/graphql/payment/types.pyindex 4b8ba494c4..5c1ddffbff 100644--- a/saleor/graphql/payment/types.py+++ b/saleor/graphql/payment/types.py@@ -8,6 +8,7 @@ from ...payment import modelsfrom ..checkout.dataloaders import CheckoutByTokenLoaderfrom ..core.connection import CountableConnectionfrom ..core.descriptions import ADDED_IN_31+from ..core.fields import JSONStringfrom ..core.types import ModelObjectType, Moneyfrom ..decorators import permission_requiredfrom ..meta.permissions import public_payment_permissions@@ -25,7 +26,7 @@ class Transaction(ModelObjectType):kind = TransactionKindEnum(required=True)is_success = graphene.Boolean(required=True)error = graphene.String()- gateway_response = graphene.JSONString(required=True)+ gateway_response = JSONString(required=True)amount = graphene.Field(Money, description="Total amount of the transaction.")class Meta:@@ -208,6 +209,4 @@ class PaymentInitialized(graphene.ObjectType):gateway = graphene.String(description="ID of a payment gateway.", required=True)name = graphene.String(description="Payment gateway name.", required=True)- data = graphene.JSONString(- description="Initialized data by gateway.", required=False- )+ data = JSONString(description="Initialized data by gateway.", required=False)diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex 3df37a0aa7..2908f86bad 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -43,6 +43,7 @@ from ...attribute.types import AttributeValueInputfrom ...attribute.utils import AttributeAssignmentMixin, AttrValuesInputfrom ...channel import ChannelContextfrom ...core.descriptions import ADDED_IN_31, PREVIEW_FEATURE+from ...core.fields import JSONStringfrom ...core.inputs import ReorderInputfrom ...core.mutations import BaseMutation, ModelDeleteMutation, ModelMutationfrom ...core.scalars import WeightScalar@@ -76,7 +77,7 @@ from ..utils import (class CategoryInput(graphene.InputObjectType):- description = graphene.JSONString(description="Category description (JSON).")+ description = JSONString(description="Category description (JSON).")name = graphene.String(description="Category name.")slug = graphene.String(description="Category slug.")seo = SeoInput(description="Search engine optimization fields.")@@ -194,9 +195,7 @@ class CollectionInput(graphene.InputObjectType):)name = graphene.String(description="Name of the collection.")slug = graphene.String(description="Slug of the collection.")- description = graphene.JSONString(- description="Description of the collection (JSON)."- )+ description = JSONString(description="Description of the collection (JSON).")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.")@@ -528,7 +527,7 @@ class ProductInput(graphene.InputObjectType):description="List of IDs of collections that the product belongs to.",name="collections",)- description = graphene.JSONString(description="Product description (JSON).")+ description = JSONString(description="Product description (JSON).")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/tests/test_product.py b/saleor/graphql/product/tests/test_product.pyindex eafea2ef9a..2ce9c48943 100644--- a/saleor/graphql/product/tests/test_product.py+++ b/saleor/graphql/product/tests/test_product.py@@ -5961,6 +5961,34 @@ def test_product_create_with_collections_webhook(get_graphql_content(response)+def test_product_create_with_invalid_json_description(staff_api_client):+ query = """+ mutation ProductCreate {+ productCreate(+ input: {+ description: "I'm not a valid JSON"+ category: "Q2F0ZWdvcnk6MjQ="+ name: "Breaky McErrorface"+ productType: "UHJvZHVjdFR5cGU6NTE="+ }+ ) {+ errors {+ field+ message+ }+ }+ }+ """++ response = staff_api_client.post_graphql(query)+ content = get_graphql_content_from_response(response)++ assert content["errors"]+ assert len(content["errors"]) == 1+ assert content["errors"][0]["extensions"]["exception"]["code"] == "GraphQLError"+ assert "is not a valid JSONString" in content["errors"][0]["message"]++MUTATION_UPDATE_PRODUCT = """mutation updateProduct($productId: ID!, $input: ProductInput!) {productUpdate(id: $productId, input: $input) {diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex c5196edbbf..a603bc306c 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -53,7 +53,7 @@ from ...core.descriptions import ()from ...core.enums import ReportingPeriodfrom ...core.federation import federated_entity, resolve_federation_references-from ...core.fields import ConnectionField, FilterConnectionField+from ...core.fields import ConnectionField, FilterConnectionField, JSONStringfrom ...core.types import (Image,ModelObjectType,@@ -728,7 +728,7 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String(required=True)- description = graphene.JSONString()+ description = JSONString()product_type = graphene.Field(lambda: ProductType, required=True)slug = graphene.String(required=True)category = graphene.Field(lambda: Category)@@ -744,7 +744,7 @@ class Product(ChannelContextTypeWithMetadata, ModelObjectType):"gateway to resolve this object in a federated query."),)- description_json = graphene.JSONString(+ description_json = JSONString(description="Description of the product (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -1374,7 +1374,7 @@ class Collection(ChannelContextTypeWithMetadata, ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String(required=True)- description = graphene.JSONString()+ description = JSONString()slug = graphene.String(required=True)channel = graphene.String(description=(@@ -1382,7 +1382,7 @@ class Collection(ChannelContextTypeWithMetadata, ModelObjectType):"gateway to resolve this object in a federated query."),)- description_json = graphene.JSONString(+ description_json = JSONString(description="Description of the collection (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -1489,11 +1489,11 @@ class Category(ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String(required=True)- description = graphene.JSONString()+ description = JSONString()slug = graphene.String(required=True)parent = graphene.Field(lambda: Category)level = graphene.Int(required=True)- description_json = graphene.JSONString(+ description_json = JSONString(description="Description of the category (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -1608,7 +1608,7 @@ class ProductMedia(ModelObjectType):sort_order = graphene.Int()alt = graphene.String(required=True)type = ProductMediaType(required=True)- oembed_data = graphene.JSONString(required=True)+ oembed_data = JSONString(required=True)url = graphene.String(required=True,description="The URL of the media.",diff --git a/saleor/graphql/shipping/mutations/shippings.py b/saleor/graphql/shipping/mutations/shippings.pyindex 2e57d7e697..f73a615a97 100644--- a/saleor/graphql/shipping/mutations/shippings.py+++ b/saleor/graphql/shipping/mutations/shippings.py@@ -17,6 +17,7 @@ from ....shipping.utils import (get_countries_without_shipping_zone,)from ...channel.types import ChannelContext+from ...core.fields import JSONStringfrom ...core.mutations import BaseMutation, ModelDeleteMutation, ModelMutationfrom ...core.scalars import WeightScalarfrom ...core.types.common import ShippingError@@ -37,7 +38,7 @@ class ShippingPostalCodeRulesCreateInputRange(graphene.InputObjectType):class ShippingPriceInput(graphene.InputObjectType):name = graphene.String(description="Name of the shipping method.")- description = graphene.JSONString(description="Shipping method description.")+ description = JSONString(description="Shipping method description.")minimum_order_weight = WeightScalar(description="Minimum order weight to use this shipping method.")diff --git a/saleor/graphql/shipping/types.py b/saleor/graphql/shipping/types.pyindex 2c526579ed..40087dbe4c 100644--- a/saleor/graphql/shipping/types.py+++ b/saleor/graphql/shipping/types.py@@ -18,7 +18,7 @@ from ..channel.types import ()from ..core.connection import CountableConnection, create_connection_slicefrom ..core.descriptions import DEPRECATED_IN_3X_FIELD-from ..core.fields import ConnectionField+from ..core.fields import ConnectionField, JSONStringfrom ..core.types import CountryDisplay, ModelObjectType, Money, MoneyRange, Weightfrom ..decorators import permission_requiredfrom ..meta.types import ObjectWithMetadata@@ -76,7 +76,7 @@ class ShippingMethodType(ChannelContextTypeWithMetadataForObjectType):id = graphene.ID(required=True, description="Shipping method ID.")name = graphene.String(required=True, description="Shipping method name.")- description = graphene.JSONString(description="Shipping method description.")+ description = JSONString(description="Shipping method description.")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 = graphene.JSONString(description="Shipping method description (JSON).")+ description = JSONString(description="Shipping method description (JSON).")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.pyindex 77d2ace56e..10bc593edb 100644--- a/saleor/graphql/translations/mutations.py+++ b/saleor/graphql/translations/mutations.py@@ -15,6 +15,7 @@ from ...site.models import SiteSettingsfrom ..attribute.types import Attribute, AttributeValuefrom ..channel import ChannelContextfrom ..core.enums import LanguageCodeEnum+from ..core.fields import JSONStringfrom ..core.mutations import BaseMutation, ModelMutationfrom ..core.types.common import TranslationErrorfrom ..discount.types import Sale, Voucher@@ -122,7 +123,7 @@ class NameTranslationInput(graphene.InputObjectType):class AttributeValueTranslationInput(NameTranslationInput):- rich_text = graphene.JSONString()+ rich_text = JSONString()class SeoTranslationInput(graphene.InputObjectType):@@ -131,11 +132,11 @@ class SeoTranslationInput(graphene.InputObjectType):class TranslationInput(NameTranslationInput, SeoTranslationInput):- description = graphene.JSONString()+ description = JSONString()class ShippingPriceTranslationInput(NameTranslationInput):- description = graphene.JSONString(+ description = JSONString(description="Translated shipping method description (JSON).")@@ -425,7 +426,7 @@ class MenuItemTranslate(BaseTranslateMutation):class PageTranslationInput(SeoTranslationInput):title = graphene.String()- content = graphene.JSONString()+ content = JSONString()class PageTranslate(BaseTranslateMutation):diff --git a/saleor/graphql/translations/types.py b/saleor/graphql/translations/types.pyindex 8e75b1435c..39bc2ecc6a 100644--- a/saleor/graphql/translations/types.py+++ b/saleor/graphql/translations/types.py@@ -17,6 +17,7 @@ from ...site import models as site_modelsfrom ..channel import ChannelContextfrom ..core.descriptions import DEPRECATED_IN_3X_FIELDfrom ..core.enums import LanguageCodeEnum+from ..core.fields import JSONStringfrom ..core.types import LanguageDisplay, ModelObjectTypefrom ..core.utils import str_to_enumfrom ..decorators import permission_required@@ -68,7 +69,7 @@ class BaseTranslationType(ModelObjectType):class AttributeValueTranslation(BaseTranslationType):id = graphene.GlobalID(required=True)name = graphene.String(required=True)- rich_text = graphene.JSONString()+ rich_text = JSONString()class Meta:model = attribute_models.AttributeValueTranslation@@ -78,7 +79,7 @@ class AttributeValueTranslation(BaseTranslationType):class AttributeValueTranslatableContent(ModelObjectType):id = graphene.GlobalID(required=True)name = graphene.String(required=True)- rich_text = graphene.JSONString()+ rich_text = JSONString()translation = TranslationField(AttributeValueTranslation, type_name="attribute value")@@ -181,8 +182,8 @@ class ProductTranslation(BaseTranslationType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String()- description = graphene.JSONString()- description_json = graphene.JSONString(+ description = JSONString()+ description_json = JSONString(description="Translated description of the product (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -204,8 +205,8 @@ class ProductTranslatableContent(ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String(required=True)- description = graphene.JSONString()- description_json = graphene.JSONString(+ description = JSONString()+ description_json = JSONString(description="Description of the product (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -252,8 +253,8 @@ class CollectionTranslation(BaseTranslationType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String()- description = graphene.JSONString()- description_json = graphene.JSONString(+ description = JSONString()+ description_json = JSONString(description="Translated description of the product (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -275,8 +276,8 @@ class CollectionTranslatableContent(ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String(required=True)- description = graphene.JSONString()- description_json = graphene.JSONString(+ description = JSONString()+ description_json = JSONString(description="Description of the collection (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -313,8 +314,8 @@ class CategoryTranslation(BaseTranslationType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String()- description = graphene.JSONString()- description_json = graphene.JSONString(+ description = JSONString()+ description_json = JSONString(description="Translated description of the product (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -336,8 +337,8 @@ class CategoryTranslatableContent(ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()name = graphene.String(required=True)- description = graphene.JSONString()- description_json = graphene.JSONString(+ description = JSONString()+ description_json = JSONString(description="Description of the category (JSON).",deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use the `description` field instead."@@ -371,8 +372,8 @@ class PageTranslation(BaseTranslationType):seo_title = graphene.String()seo_description = graphene.String()title = graphene.String()- content = graphene.JSONString()- content_json = graphene.JSONString(+ content = JSONString()+ content_json = JSONString(description="Translated description of the page (JSON).",deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use the `content` field instead.",)@@ -392,8 +393,8 @@ class PageTranslatableContent(ModelObjectType):seo_title = graphene.String()seo_description = graphene.String()title = graphene.String(required=True)- content = graphene.JSONString()- content_json = graphene.JSONString(+ content = JSONString()+ content_json = JSONString(description="Content of the page (JSON).",deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use the `content` field instead.",)@@ -555,7 +556,7 @@ class MenuItemTranslatableContent(ModelObjectType):class ShippingMethodTranslation(BaseTranslationType):id = graphene.GlobalID(required=True)name = graphene.String()- description = graphene.JSONString()+ description = JSONString()class Meta:model = shipping_models.ShippingMethodTranslation@@ -565,7 +566,7 @@ class ShippingMethodTranslation(BaseTranslationType):class ShippingMethodTranslatableContent(ModelObjectType):id = graphene.GlobalID(required=True)name = graphene.String(required=True)- description = graphene.JSONString()+ description = JSONString()translation = TranslationField(ShippingMethodTranslation, type_name="shipping method")diff --git a/saleor/graphql/webhook/schema.py b/saleor/graphql/webhook/schema.pyindex 556e74dfcd..5490aef40a 100644--- a/saleor/graphql/webhook/schema.py+++ b/saleor/graphql/webhook/schema.py@@ -2,6 +2,7 @@ import graphenefrom ...core.permissions import AppPermissionfrom ..core.descriptions import DEPRECATED_IN_3X_FIELD+from ..core.fields import JSONStringfrom ..decorators import permission_requiredfrom .enums import WebhookSampleEventTypeEnumfrom .mutations import EventDeliveryRetry, WebhookCreate, WebhookDelete, WebhookUpdate@@ -26,7 +27,7 @@ class WebhookQueries(graphene.ObjectType):),)webhook_sample_payload = graphene.Field(- graphene.JSONString,+ JSONString,event_type=graphene.Argument(WebhookSampleEventTypeEnum,required=True,