Skip to content

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

Deprecate user field in accountRegister (#18175)

Maciej Korycinski9c6b27dffb9a
diff --git a/saleor/graphql/account/mutations/account/account_register.py b/saleor/graphql/account/mutations/account/account_register.py
index 52d06a3a90..b8a22a1734 100644
--- a/saleor/graphql/account/mutations/account/account_register.py
+++ b/saleor/graphql/account/mutations/account/account_register.py
@@ -58,6 +58,15 @@ class AccountRegisterInput(AccountBaseInput):
class AccountRegister(DeprecatedModelMutation):
+ user = graphene.Field(
+ User,
+ deprecation_reason=(
+ "The field always returns a `User` object constructed from the input data. "
+ "The `user.id` is always empty. To determine whether the user exists "
+ "in Saleor, query via an external app with the required permissions."
+ ),
+ )
+
class Arguments:
input = AccountRegisterInput(
description="Fields required to create a user.", required=True
diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.py
index 5df9b1a549..87b308090d 100644
--- a/saleor/graphql/core/mutations.py
+++ b/saleor/graphql/core/mutations.py
@@ -690,7 +690,9 @@ class DeprecatedModelMutation(BaseMutation):
f"GraphQL type for model {cls._meta.model.__name__} could not be "
f"resolved for {cls.__name__}"
)
- fields = {return_field_name: graphene.Field(model_type)}
+ fields = {}
+ if not cls._meta.fields.get(return_field_name):
+ fields[return_field_name] = graphene.Field(model_type)
cls._update_mutation_arguments_and_fields(arguments=arguments, fields=fields)
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 03732a0d59..c32b5f4fd4 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -24600,6 +24600,7 @@ Confirms an unconfirmed order by changing status to unfulfilled.
Requires one of the following permissions: MANAGE_ORDERS.
"""
type OrderConfirm @doc(category: "Orders") {
+ """Order which has been confirmed."""
order: Order
orderErrors: [OrderError!]! @deprecated(reason: "Use `errors` field instead.")
errors: [OrderError!]!
@@ -28790,6 +28791,7 @@ Triggers the following webhook events:
- ATTRIBUTE_CREATED (async): An attribute was created.
"""
type AttributeCreate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_CREATED], syncEvents: []) {
+ """The created attribute."""
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "Use `errors` field instead.")
errors: [AttributeError!]!
@@ -28925,6 +28927,7 @@ Triggers the following webhook events:
- ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
type AttributeUpdate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_UPDATED], syncEvents: []) {
+ """The updated attribute."""
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "Use `errors` field instead.")
errors: [AttributeError!]!
@@ -30095,11 +30098,12 @@ Triggers the following webhook events:
- ACCOUNT_CONFIRMATION_REQUESTED (async): An user confirmation was requested. This event is always sent regardless of settings.
"""
type AccountRegister @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, NOTIFY_USER, ACCOUNT_CONFIRMATION_REQUESTED], syncEvents: []) {
+ user: User @deprecated(reason: "The field always returns a `User` object constructed from the input data. The `user.id` is always empty. To determine whether the user exists in Saleor, query via an external app with the required permissions.")
+
"""Informs whether users need to confirm their email address."""
requiresConfirmation: Boolean
accountErrors: [AccountError!]! @deprecated(reason: "Use `errors` field instead.")
errors: [AccountError!]!
- user: User
}
"""Fields required to create a user."""