Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add missing doc_category to events (#13815)
Marcin Gębalab4de8321619d
diff --git a/saleor/graphql/core/doc_category.py b/saleor/graphql/core/doc_category.pyindex 02384e3043..bf48e2ab3f 100644--- a/saleor/graphql/core/doc_category.py+++ b/saleor/graphql/core/doc_category.py@@ -6,6 +6,7 @@ DOC_CATEGORY_CHECKOUT = "Checkout"DOC_CATEGORY_DISCOUNTS = "Discounts"DOC_CATEGORY_GIFT_CARDS = "Gift cards"DOC_CATEGORY_MENU = "Menu"+DOC_CATEGORY_MISC = "Miscellaneous"DOC_CATEGORY_ORDERS = "Orders"DOC_CATEGORY_PAGES = "Pages"DOC_CATEGORY_PAYMENTS = "Payments"diff --git a/saleor/graphql/core/types/event.py b/saleor/graphql/core/types/event.pyindex 5d07a43e27..d53ef4de23 100644--- a/saleor/graphql/core/types/event.py+++ b/saleor/graphql/core/types/event.py@@ -35,4 +35,9 @@ class SubscriptionObjectType(BaseObjectType):):options["doc_category"] = DOC_CATEGORY_MODEL_MAP[root_type]+ if "doc_category" not in options and root_type is None:+ raise NotImplementedError(+ f"SubscriptionObjectType {cls.__name__} must have a root_type defined."+ )+super().__init_subclass_with_meta__(_meta=_meta, **options)diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 5203f9d31e..37107f3646 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -29567,7 +29567,7 @@ type PermissionGroupDelete @doc(category: "Users") @webhookEventsInfo(asyncEventgroup: Group}-type Subscription {+type Subscription @doc(category: "Miscellaneous") {"""Look up subscription event.@@ -29709,7 +29709,7 @@ Event sent when account email is changed.Added in Saleor 3.15."""-type AccountEmailChanged implements Event {+type AccountEmailChanged implements Event @doc(category: "Users") {"""Time of the event."""issuedAt: DateTime@@ -29746,7 +29746,7 @@ Event sent when setting a new password is requested.Added in Saleor 3.15."""-type AccountSetPasswordRequested implements Event {+type AccountSetPasswordRequested implements Event @doc(category: "Users") {"""Time of the event."""issuedAt: DateTime@@ -29780,7 +29780,7 @@ Event sent when account is confirmed.Added in Saleor 3.15."""-type AccountConfirmed implements Event {+type AccountConfirmed implements Event @doc(category: "Users") {"""Time of the event."""issuedAt: DateTime@@ -29848,7 +29848,7 @@ Event sent when account is deleted.Added in Saleor 3.15."""-type AccountDeleted implements Event {+type AccountDeleted implements Event @doc(category: "Users") {"""Time of the event."""issuedAt: DateTime@@ -30908,7 +30908,7 @@ Added in Saleor 3.14.Note: this API is currently in Feature Preview and can be subject to changes at later point."""-type OrderBulkCreated implements Event {+type OrderBulkCreated implements Event @doc(category: "Orders") {"""Time of the event."""issuedAt: DateTime@@ -32425,7 +32425,7 @@ Event sent when setting a new password for staff is requested.Added in Saleor 3.15."""-type StaffSetPasswordRequested implements Event {+type StaffSetPasswordRequested implements Event @doc(category: "Users") {"""Time of the event."""issuedAt: DateTime@@ -32481,7 +32481,7 @@ Event sent when new translation is created.Added in Saleor 3.2."""-type TranslationCreated implements Event {+type TranslationCreated implements Event @doc(category: "Miscellaneous") {"""Time of the event."""issuedAt: DateTime@@ -32505,7 +32505,7 @@ Event sent when translation is updated.Added in Saleor 3.2."""-type TranslationUpdated implements Event {+type TranslationUpdated implements Event @doc(category: "Miscellaneous") {"""Time of the event."""issuedAt: DateTime@@ -32715,7 +32715,7 @@ Event sent when thumbnail is created.Added in Saleor 3.12."""-type ThumbnailCreated implements Event {+type ThumbnailCreated implements Event @doc(category: "Miscellaneous") {"""Time of the event."""issuedAt: DateTimediff --git a/saleor/graphql/webhook/subscription_types.py b/saleor/graphql/webhook/subscription_types.pyindex edf88be8b0..254c13f094 100644--- a/saleor/graphql/webhook/subscription_types.py+++ b/saleor/graphql/webhook/subscription_types.py@@ -53,11 +53,13 @@ from ..core.descriptions import (from ..core.doc_category import (DOC_CATEGORY_CHECKOUT,DOC_CATEGORY_GIFT_CARDS,+ DOC_CATEGORY_MISC,DOC_CATEGORY_ORDERS,DOC_CATEGORY_PAYMENTS,DOC_CATEGORY_PRODUCTS,DOC_CATEGORY_SHIPPING,DOC_CATEGORY_TAXES,+ DOC_CATEGORY_USERS,)from ..core.scalars import JSON, PositiveDecimalfrom ..core.types import NonNullList, SubscriptionObjectType@@ -187,6 +189,7 @@ class AccountConfirmed(SubscriptionObjectType, AccountOperationBase):enable_dry_run = Falseinterfaces = (Event,)description = "Event sent when account is confirmed." + ADDED_IN_315+ doc_category = DOC_CATEGORY_USERSclass AccountConfirmationRequested(SubscriptionObjectType, AccountOperationBase):@@ -230,6 +233,7 @@ class AccountEmailChanged(SubscriptionObjectType, AccountOperationBase):enable_dry_run = Falseinterfaces = (Event,)description = "Event sent when account email is changed." + ADDED_IN_315+ doc_category = DOC_CATEGORY_USERSclass AccountSetPasswordRequested(SubscriptionObjectType, AccountOperationBase):@@ -240,6 +244,7 @@ class AccountSetPasswordRequested(SubscriptionObjectType, AccountOperationBase):description = ("Event sent when setting a new password is requested." + ADDED_IN_315)+ doc_category = DOC_CATEGORY_USERSclass AccountDeleteRequested(SubscriptionObjectType, AccountOperationBase):@@ -256,6 +261,7 @@ class AccountDeleted(SubscriptionObjectType, AccountOperationBase):enable_dry_run = Falseinterfaces = (Event,)description = "Event sent when account is deleted." + ADDED_IN_315+ doc_category = DOC_CATEGORY_USERSclass AddressBase(AbstractType):@@ -626,6 +632,7 @@ class OrderBulkCreated(SubscriptionObjectType):description = ("Event sent when orders are imported." + ADDED_IN_314 + PREVIEW_FEATURE)+ doc_category = DOC_CATEGORY_ORDERSclass DraftOrderCreated(SubscriptionObjectType, OrderBase):@@ -1658,6 +1665,7 @@ class StaffSetPasswordRequested(SubscriptionObjectType, AccountOperationBase):"Event sent when setting a new password for staff is requested."+ ADDED_IN_315)+ doc_category = DOC_CATEGORY_USERSclass TransactionAction(SubscriptionObjectType, AbstractType):@@ -2057,6 +2065,7 @@ class TranslationCreated(SubscriptionObjectType, TranslationBase):enable_dry_run = Falseinterfaces = (Event,)description = "Event sent when new translation is created." + ADDED_IN_32+ doc_category = DOC_CATEGORY_MISCclass TranslationUpdated(SubscriptionObjectType, TranslationBase):@@ -2065,6 +2074,7 @@ class TranslationUpdated(SubscriptionObjectType, TranslationBase):enable_dry_run = Falseinterfaces = (Event,)description = "Event sent when translation is updated." + ADDED_IN_32+ doc_category = DOC_CATEGORY_MISCclass VoucherBase(AbstractType):@@ -2346,6 +2356,9 @@ class Subscription(SubscriptionObjectType):description="Look up subscription event." + ADDED_IN_32,)+ class Meta:+ doc_category = DOC_CATEGORY_MISC+@staticmethoddef resolve_event(root, info: ResolveInfo):return Observable.from_([root])@@ -2364,6 +2377,7 @@ class ThumbnailCreated(SubscriptionObjectType):enable_dry_run = Falseinterfaces = (Event,)description = "Event sent when thumbnail is created." + ADDED_IN_312+ doc_category = DOC_CATEGORY_MISC@staticmethoddef resolve_id(root, info: ResolveInfo):