Skip to content

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

Add message about fields added in 3.1

Marcin Gębala497cb116d359
diff --git a/saleor/graphql/app/schema.py b/saleor/graphql/app/schema.py
index 4baa660ecf..2cc75bddbb 100644
--- a/saleor/graphql/app/schema.py
+++ b/saleor/graphql/app/schema.py
@@ -1,6 +1,7 @@
import graphene
from ...core.permissions import AppPermission
+from ..core.descriptions import ADDED_IN_31
from ..core.fields import FilterInputConnectionField
from ..core.types import FilterInputObjectType
from ..core.utils import from_global_id_or_error
@@ -67,14 +68,14 @@ class AppQueries(graphene.ObjectType):
filter=AppExtensionFilterInput(
description="Filtering options for apps extensions."
),
- description="List of all extensions",
+ description=f"{ADDED_IN_31} List of all extensions",
)
app_extension = graphene.Field(
AppExtension,
id=graphene.Argument(
graphene.ID, description="ID of the app extension.", required=True
),
- description="Look up an app extension by ID.",
+ description=f"{ADDED_IN_31} Look up an app extension by ID.",
)
@permission_required(AppPermission.MANAGE_APPS)
diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.py
index 2e0c944260..58da71c111 100644
--- a/saleor/graphql/app/types.py
+++ b/saleor/graphql/app/types.py
@@ -5,6 +5,7 @@ from ...app import models
from ...core.exceptions import PermissionDenied
from ...core.permissions import AppPermission
from ..core.connection import CountableDjangoObjectType
+from ..core.descriptions import ADDED_IN_31
from ..core.types import Permission
from ..core.types.common import Job
from ..meta.types import ObjectWithMetadata
@@ -159,7 +160,7 @@ class App(CountableDjangoObjectType):
)
extensions = graphene.List(
graphene.NonNull(AppExtension),
- description="App's dashboard extensions.",
+ description=f"{ADDED_IN_31} App's dashboard extensions.",
required=True,
)
diff --git a/saleor/graphql/channel/mutations.py b/saleor/graphql/channel/mutations.py
index 3db23f9d14..3d9c880f58 100644
--- a/saleor/graphql/channel/mutations.py
+++ b/saleor/graphql/channel/mutations.py
@@ -12,6 +12,7 @@ from ...core.tracing import traced_atomic_transaction
from ...order.models import Order
from ...shipping.tasks import drop_invalid_shipping_methods_relations_for_given_channels
from ..account.enums import CountryCodeEnum
+from ..core.descriptions import ADDED_IN_31
from ..core.mutations import BaseMutation, ModelDeleteMutation, ModelMutation
from ..core.types.common import ChannelError, ChannelErrorCode
from ..core.utils import get_duplicated_values, get_duplicates_ids
@@ -31,9 +32,9 @@ class ChannelCreateInput(ChannelInput):
)
default_country = CountryCodeEnum(
description=(
- "Default country for the channel. Default country can be used in checkout "
- "to determine the stock quantities or calculate taxes when the country was "
- "not explicitly provided."
+ f"{ADDED_IN_31} Default country for the channel. Default country can be "
+ "used in checkout to determine the stock quantities or calculate taxes "
+ "when the country was not explicitly provided."
),
required=True,
)
@@ -84,9 +85,9 @@ class ChannelUpdateInput(ChannelInput):
slug = graphene.String(description="Slug of the channel.")
default_country = CountryCodeEnum(
description=(
- "Default country for the channel. Default country can be used in checkout "
- "to determine the stock quantities or calculate taxes when the country was "
- "not explicitly provided."
+ f"{ADDED_IN_31} Default country for the channel. Default country can be "
+ "used in checkout to determine the stock quantities or calculate taxes "
+ "when the country was not explicitly provided."
)
)
add_shipping_zones = graphene.List(
diff --git a/saleor/graphql/channel/types.py b/saleor/graphql/channel/types.py
index 7662177df0..27fa7b5829 100644
--- a/saleor/graphql/channel/types.py
+++ b/saleor/graphql/channel/types.py
@@ -5,6 +5,7 @@ from graphene_django import DjangoObjectType
from ...channel import models
from ...core.permissions import ChannelPermissions
from ..core.connection import CountableDjangoObjectType
+from ..core.descriptions import ADDED_IN_31
from ..core.types import CountryDisplay
from ..decorators import permission_required
from ..meta.types import ObjectWithMetadata
@@ -68,9 +69,9 @@ class Channel(CountableDjangoObjectType):
default_country = graphene.Field(
CountryDisplay,
description=(
- "Default country for the channel. Default country can be used in checkout "
- "to determine the stock quantities or calculate taxes when the country was "
- "not explicitly provided."
+ f"{ADDED_IN_31} Default country for the channel. Default country can be "
+ "used in checkout to determine the stock quantities or calculate taxes "
+ "when the country was not explicitly provided."
),
required=True,
)
diff --git a/saleor/graphql/core/descriptions.py b/saleor/graphql/core/descriptions.py
index 0f29c24f11..7c5b66162e 100644
--- a/saleor/graphql/core/descriptions.py
+++ b/saleor/graphql/core/descriptions.py
@@ -5,3 +5,6 @@ DEPRECATED_IN_3X_FIELD = "This field will be removed in Saleor 4.0."
# Deprecation message for input fields and query arguments. Use it, when
# deprecation message needs to be included in the field description.
DEPRECATED_IN_3X_INPUT = "\n\nDEPRECATED: this field will be removed in Saleor 4.0."
+
+
+ADDED_IN_31 = "New in Saleor 3.1."
diff --git a/saleor/graphql/giftcard/mutations.py b/saleor/graphql/giftcard/mutations.py
index 1647525831..26823d187f 100644
--- a/saleor/graphql/giftcard/mutations.py
+++ b/saleor/graphql/giftcard/mutations.py
@@ -9,7 +9,7 @@ from ...core.utils.validators import date_passed, user_is_valid
from ...giftcard import GiftCardExpiryType, events, models
from ...giftcard.error_codes import GiftCardErrorCode
from ...giftcard.utils import activate_gift_card, deactivate_gift_card
-from ..core.descriptions import DEPRECATED_IN_3X_INPUT
+from ..core.descriptions import ADDED_IN_31, DEPRECATED_IN_3X_INPUT
from ..core.mutations import BaseMutation, ModelDeleteMutation, ModelMutation
from ..core.scalars import PositiveDecimal
from ..core.types.common import GiftCardError, PriceInput, TimePeriodInputType
@@ -27,7 +27,7 @@ class GiftCardExpirySettingsInput(graphene.InputObjectType):
class GiftCardInput(graphene.InputObjectType):
- tag = graphene.String(description="The gift card tag.")
+ tag = graphene.String(description=f"{ADDED_IN_31} The gift card tag.")
# DEPRECATED
start_date = graphene.types.datetime.Date(
@@ -52,7 +52,7 @@ class GiftCardCreateInput(GiftCardInput):
description="Email of the customer to whom gift card will be sent.",
)
expiry_settings = GiftCardExpirySettingsInput(
- description="The gift card expiry settings.", required=True
+ description=f"{ADDED_IN_31} The gift card expiry settings.", required=True
)
code = graphene.String(
required=False,
@@ -66,10 +66,10 @@ class GiftCardCreateInput(GiftCardInput):
class GiftCardUpdateInput(GiftCardInput):
balance_amount = PositiveDecimal(
- description="The gift card balance amount.", required=False
+ description=f"{ADDED_IN_31} The gift card balance amount.", required=False
)
expiry_settings = GiftCardExpirySettingsInput(
- description="The gift card expiry settings.", required=False
+ description=f"{ADDED_IN_31} The gift card expiry settings.", required=False
)
@@ -247,7 +247,7 @@ class GiftCardDelete(ModelDeleteMutation):
id = graphene.ID(description="ID of the gift card to delete.", required=True)
class Meta:
- description = "Delete gift card."
+ description = f"{ADDED_IN_31} Delete gift card."
model = models.GiftCard
permissions = (GiftcardPermissions.MANAGE_GIFT_CARD,)
error_type_class = GiftCardError
diff --git a/saleor/graphql/giftcard/schema.py b/saleor/graphql/giftcard/schema.py
index 4f376fbe46..2839f9fc5e 100644
--- a/saleor/graphql/giftcard/schema.py
+++ b/saleor/graphql/giftcard/schema.py
@@ -1,6 +1,7 @@
import graphene
from ...core.permissions import GiftcardPermissions
+from ..core.descriptions import ADDED_IN_31
from ..core.fields import FilterInputConnectionField
from ..core.utils import from_global_id_or_error
from ..decorators import permission_required
@@ -26,7 +27,9 @@ class GiftCardQueries(graphene.ObjectType):
)
gift_cards = FilterInputConnectionField(
GiftCard,
- filter=GiftCardFilterInput(description="Filtering options for gift cards."),
+ filter=GiftCardFilterInput(
+ description=f"{ADDED_IN_31} Filtering options for gift cards."
+ ),
description="List of gift cards.",
)
diff --git a/saleor/graphql/giftcard/types.py b/saleor/graphql/giftcard/types.py
index 6ba2b88459..d474855aa7 100644
--- a/saleor/graphql/giftcard/types.py
+++ b/saleor/graphql/giftcard/types.py
@@ -15,7 +15,7 @@ from ..account.utils import requestor_has_access
from ..app.dataloaders import AppByIdLoader
from ..app.types import App
from ..core.connection import CountableDjangoObjectType
-from ..core.descriptions import DEPRECATED_IN_3X_FIELD
+from ..core.descriptions import ADDED_IN_31, DEPRECATED_IN_3X_FIELD
from ..core.types.common import TimePeriod
from ..core.types.money import Money
from ..decorators import permission_required
@@ -219,39 +219,49 @@ class GiftCard(CountableDjangoObjectType):
)
created_by = graphene.Field(
"saleor.graphql.account.types.User",
- description="The user who bought or issued a gift card.",
+ description=f"{ADDED_IN_31} The user who bought or issued a gift card.",
)
used_by = graphene.Field(
"saleor.graphql.account.types.User",
- description="The customer who used a gift card.",
+ description=f"{ADDED_IN_31} The customer who used a gift card.",
)
created_by_email = graphene.String(
required=False,
- description="Email address of the user who bought or issued gift card.",
+ description=(
+ f"{ADDED_IN_31} Email address of the user who bought or issued gift card."
+ ),
)
used_by_email = graphene.String(
required=False,
- description="Email address of the customer who used a gift card.",
+ description=(
+ f"{ADDED_IN_31} Email address of the customer who used a gift card."
+ ),
)
app = graphene.Field(
App,
- description="App which created the gift card.",
+ description=f"{ADDED_IN_31} App which created the gift card.",
)
expiry_type = GiftCardExpiryTypeEnum(
- description="The gift card expiry type.", required=True
+ description=f"{ADDED_IN_31} The gift card expiry type.", required=True
)
expiry_period = graphene.Field(
- TimePeriod, description="The gift card expiry period.", required=False
+ TimePeriod,
+ description=f"{ADDED_IN_31} The gift card expiry period.",
+ required=False,
+ )
+ expiry_date = graphene.types.datetime.Date(
+ description=f"{ADDED_IN_31} The gift card expiry date."
)
product = graphene.Field(
"saleor.graphql.product.types.products.Product",
- description="Related gift card product.",
+ description=f"{ADDED_IN_31} Related gift card product.",
)
events = graphene.List(
graphene.NonNull(GiftCardEvent),
- description="List of events associated with the gift card.",
+ description=f"{ADDED_IN_31} List of events associated with the gift card.",
required=True,
)
+ tag = graphene.String(description=f"{ADDED_IN_31} The gift card tag.")
# DEPRECATED
user = graphene.Field(
diff --git a/saleor/graphql/order/mutations/fulfillments.py b/saleor/graphql/order/mutations/fulfillments.py
index 9e060341a0..2490db10e9 100644
--- a/saleor/graphql/order/mutations/fulfillments.py
+++ b/saleor/graphql/order/mutations/fulfillments.py
@@ -18,6 +18,7 @@ from ....order.actions import (
)
from ....order.error_codes import OrderErrorCode
from ....order.notifications import send_fulfillment_update
+from ...core.descriptions import ADDED_IN_31
from ...core.mutations import BaseMutation
from ...core.scalars import PositiveDecimal
from ...core.types.common import OrderError
@@ -366,7 +367,7 @@ class FulfillmentApprove(BaseMutation):
)
class Meta:
- description = "Approve existing fulfillment."
+ description = f"{ADDED_IN_31} Approve existing fulfillment."
permissions = (OrderPermissions.MANAGE_ORDERS,)
error_type_class = OrderError
error_type_field = "order_errors"
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 7110fb2a15..a3aaf9b0d9 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -43,7 +43,7 @@ from ..app.types import App
from ..channel import ChannelContext
from ..channel.dataloaders import ChannelByIdLoader, ChannelByOrderLineIdLoader
from ..core.connection import CountableDjangoObjectType
-from ..core.descriptions import DEPRECATED_IN_3X_FIELD
+from ..core.descriptions import ADDED_IN_31, DEPRECATED_IN_3X_FIELD
from ..core.enums import LanguageCodeEnum
from ..core.mutations import validation_error_to_error_type
from ..core.scalars import PositiveDecimal
@@ -443,7 +443,8 @@ class OrderLine(CountableDjangoObjectType):
description="List of allocations across warehouses.",
)
quantity_to_fulfill = graphene.Int(
- required=True, description="A quantity of items remaining to be fulfilled."
+ required=True,
+ description=f"{ADDED_IN_31} A quantity of items remaining to be fulfilled.",
)
unit_discount_type = graphene.Field(
DiscountValueTypeEnum,
diff --git a/saleor/graphql/shop/mutations.py b/saleor/graphql/shop/mutations.py
index 152b742d08..b0f38fe12e 100644
--- a/saleor/graphql/shop/mutations.py
+++ b/saleor/graphql/shop/mutations.py
@@ -7,6 +7,7 @@ from ...core.permissions import OrderPermissions, SitePermissions
from ...core.utils.url import validate_storefront_url
from ..account.i18n import I18nMixin
from ..account.types import AddressInput
+from ..core.descriptions import ADDED_IN_31
from ..core.enums import WeightUnitsEnum
from ..core.mutations import BaseMutation, ModelDeleteMutation, ModelMutation
from ..core.types.common import OrderSettingsError, ShopError
@@ -29,10 +30,12 @@ class ShopSettingsInput(graphene.InputObjectType):
description="Enable automatic fulfillment for all digital products."
)
fulfillment_auto_approve = graphene.Boolean(
- description="Enable automatic approval of all new fulfillments."
+ description=f"{ADDED_IN_31} Enable automatic approval of all new fulfillments."
)
fulfillment_allow_unpaid = graphene.Boolean(
- description="Enable ability to approve fulfillments which are unpaid."
+ description=(
+ f"{ADDED_IN_31} Enable ability to approve fulfillments which are unpaid."
+ )
)
default_digital_max_downloads = graphene.Int(
description="Default number of max downloads per digital content URL."
diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.py
index c311b4ae3a..6a10f0269b 100644
--- a/saleor/graphql/shop/types.py
+++ b/saleor/graphql/shop/types.py
@@ -16,7 +16,7 @@ from ...site import models as site_models
from ..account.types import Address, AddressInput, StaffNotificationRecipient
from ..checkout.types import PaymentGateway
from ..core.connection import CountableDjangoObjectType
-from ..core.descriptions import DEPRECATED_IN_3X_INPUT
+from ..core.descriptions import ADDED_IN_31, DEPRECATED_IN_3X_INPUT
from ..core.enums import LanguageCodeEnum, WeightUnitsEnum
from ..core.types.common import CountryDisplay, LanguageDisplay, Permission
from ..core.utils import str_to_enum
@@ -122,7 +122,9 @@ class Shop(graphene.ObjectType):
)
channel_currencies = graphene.List(
graphene.NonNull(graphene.String),
- description="List of all currencies supported by shop's channels.",
+ description=(
+ f"{ADDED_IN_31} List of all currencies supported by shop's channels."
+ ),
required=True,
)
countries = graphene.List(
@@ -165,10 +167,12 @@ class Shop(graphene.ObjectType):
description="Include taxes in prices.", required=True
)
fulfillment_auto_approve = graphene.Boolean(
- description="Automatically approve all new fulfillments.", required=True
+ description=f"{ADDED_IN_31} Automatically approve all new fulfillments.",
+ required=True,
)
fulfillment_allow_unpaid = graphene.Boolean(
- description="Allow to approve fulfillments which are unpaid.", required=True
+ description=f"{ADDED_IN_31} Allow to approve fulfillments which are unpaid.",
+ required=True,
)
display_gross_prices = graphene.Boolean(
description="Display prices with tax in store.", required=True