From 9ddce9c6146c65a2df91d7a04b1a09318c1bd510 Mon Sep 17 00:00:00 2001 From: Igor Melnykov Date: Tue, 20 Oct 2020 14:17:42 -0500 Subject: [PATCH 1/7] Support of custom attributes --- .../custom-attributes/attributes-metadata.md | 1 + .../graph-ql/coverage/customer/customer.graphqls | 13 +++++++++++-- design-documents/graph-ql/coverage/returns.graphqls | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md b/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md index 9d4b868c5..044bbb3ae 100644 --- a/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md +++ b/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md @@ -34,6 +34,7 @@ type Attribute { attribute_type: String entity_type: String input_type: String + is_required: Bolean! } type AttributeOption { diff --git a/design-documents/graph-ql/coverage/customer/customer.graphqls b/design-documents/graph-ql/coverage/customer/customer.graphqls index 42075d0f8..5b363bc22 100644 --- a/design-documents/graph-ql/coverage/customer/customer.graphqls +++ b/design-documents/graph-ql/coverage/customer/customer.graphqls @@ -45,7 +45,8 @@ input CustomerAddressInput { prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") suffix: String @doc(description: "A value such as Sr., Jr., or III") vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") - custom_attributes: [CustomerAddressAttributeInput] @doc(description: "Deprecated: Custom attributes should not be put into container.") + custom_attributes: [CustomerAddressAttributeInput] @deprecated(reason: "Use custom_attributes_v2.") + custom_attributes_v2: [CustomAttributeInput] @doc(description: "Custom attributes.") } input CustomerAddressRegionInput @doc(description: "CustomerAddressRegionInput defines the customer's state or province") { @@ -59,6 +60,11 @@ input CustomerAddressAttributeInput { value: String! @doc(description: "Attribute value") } +input CustomAttributeInput { + attribute_code: String! @doc(description: "Code.") + values: [String]! @doc(description: "Values.") +} + type CustomerToken { token: String @doc(description: "The customer token") } @@ -76,6 +82,7 @@ input CustomerInput { gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") password: String @doc(description: "The customer's password") is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") + custom_attributes: [CustomAttributeInput] @doc(description: "Custom attributes.") } type CustomerOutput { @@ -104,6 +111,7 @@ type Customer @doc(description: "Customer defines the customer name and address is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\IsSubscribed") addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\CustomerAddresses") gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") + custom_attributes: [CustomAttribute]! } type CustomerAddress @doc(description: "CustomerAddress contains detailed information about a customer's billing and shipping addresses"){ @@ -128,7 +136,8 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform vat_id: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)") default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") - custom_attributes: [CustomerAddressAttribute] @deprecated(reason: "Custom attributes should not be put into container") + custom_attributes: [CustomerAddressAttribute] @deprecated(reason: "Use custom_attributes_v2 field.") + custom_attributes_v2: [CustomAttribute]! @doc(description: "Custom attributes.") extension_attributes: [CustomerAddressAttribute] @doc(description: "Address extension attributes") } diff --git a/design-documents/graph-ql/coverage/returns.graphqls b/design-documents/graph-ql/coverage/returns.graphqls index ed6db8eee..8b4e00041 100644 --- a/design-documents/graph-ql/coverage/returns.graphqls +++ b/design-documents/graph-ql/coverage/returns.graphqls @@ -129,7 +129,7 @@ type ReturnItem { type CustomAttribute { uid: ID! label: String! - value: String! @doc(description: "JSON encoded value of the attribute.") + values: [String]! @doc(description: "JSON encoded value of the attribute.") } type ReturnComment { From 15c842c5255046269911c67278b1ec45db659917 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Wed, 3 Feb 2021 18:53:44 -0600 Subject: [PATCH 2/7] -reusing Attributes object -adding entered and selected values --- .../coverage/customer/customer.graphqls | 92 ++++++++++++++----- .../graph-ql/coverage/returns.graphqls | 9 +- 2 files changed, 70 insertions(+), 31 deletions(-) diff --git a/design-documents/graph-ql/coverage/customer/customer.graphqls b/design-documents/graph-ql/coverage/customer/customer.graphqls index 5b363bc22..258674a6a 100644 --- a/design-documents/graph-ql/coverage/customer/customer.graphqls +++ b/design-documents/graph-ql/coverage/customer/customer.graphqls @@ -8,23 +8,25 @@ type StoreConfig { } type Query { - customer: Customer @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\Customer") @doc(description: "The customer query returns information about a customer account") @cache(cacheable: false) + customer: Customer @doc(description: "The customer query returns information about a customer account") @cache(cacheable: false) isEmailAvailable ( email: String! @doc(description: "The new customer email") - ): IsEmailAvailableOutput @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\IsEmailAvailable") + ): IsEmailAvailableOutput } type Mutation { - generateCustomerToken(email: String!, password: String!): CustomerToken @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\GenerateCustomerToken") @doc(description:"Retrieve the customer token") - changeCustomerPassword(currentPassword: String!, newPassword: String!): Customer @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ChangePassword") @doc(description:"Changes the password for the logged-in customer") - createCustomer (input: CustomerInput!): CustomerOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomer") @doc(description:"Create customer account") - updateCustomer (input: CustomerInput!): CustomerOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomer") @doc(description:"Update the customer's personal information") - revokeCustomerToken: RevokeCustomerTokenOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RevokeCustomerToken") @doc(description:"Revoke the customer token") - createCustomerAddress(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomerAddress") @doc(description: "Create customer address") - updateCustomerAddress(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomerAddress") @doc(description: "Update customer address") - deleteCustomerAddress(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\DeleteCustomerAddress") @doc(description: "Delete customer address") - requestPasswordResetEmail(email: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RequestPasswordResetEmail") @doc(description: "Request an email with a reset password token for the registered customer identified by the specified email.") - resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ResetPassword") @doc(description: "Reset a customer's password using the reset password token that the customer received in an email after requesting it using requestPasswordResetEmail.") + generateCustomerToken(email: String!, password: String!): CustomerToken @doc(description:"Retrieve the customer token") + changeCustomerPassword(currentPassword: String!, newPassword: String!): Customer @doc(description:"Changes the password for the logged-in customer") + createCustomer (input: CustomerInput!): CustomerOutput @deprecated(reason: "createCustomerV2") @doc(description:"Create customer account") + createCustomerV2 (input: CustomerCreateInput!): CustomerOutput @doc(description:"Create customer account") + updateCustomer (input: CustomerInput!): CustomerOutput @deprecated(reason: "createCustomerV2") @doc(description:"Update the customer's personal information") + updateCustomerV2 (input: CustomerUpdateInput!): CustomerOutput @doc(description:"Update the customer's personal information") + revokeCustomerToken: RevokeCustomerTokenOutput @doc(description:"Revoke the customer token") + createCustomerAddress(input: CustomerAddressInput!): CustomerAddress @doc(description: "Create customer address") + updateCustomerAddress(id: Int!, input: CustomerAddressInput): CustomerAddress @doc(description: "Update customer address") + deleteCustomerAddress(id: Int!): Boolean @doc(description: "Delete customer address") + requestPasswordResetEmail(email: String!): Boolean @doc(description: "Request an email with a reset password token for the registered customer identified by the specified email.") + resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean @doc(description: "Reset a customer's password using the reset password token that the customer received in an email after requesting it using requestPasswordResetEmail.") } input CustomerAddressInput { @@ -45,8 +47,8 @@ input CustomerAddressInput { prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") suffix: String @doc(description: "A value such as Sr., Jr., or III") vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") - custom_attributes: [CustomerAddressAttributeInput] @deprecated(reason: "Use custom_attributes_v2.") - custom_attributes_v2: [CustomAttributeInput] @doc(description: "Custom attributes.") + custom_attributes: [CustomerAddressAttributeInput] @deprecated(reason: "Use `stored_attributes`instead.") + stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") } input CustomerAddressRegionInput @doc(description: "CustomerAddressRegionInput defines the customer's state or province") { @@ -60,9 +62,10 @@ input CustomerAddressAttributeInput { value: String! @doc(description: "Attribute value") } -input CustomAttributeInput { - attribute_code: String! @doc(description: "Code.") - values: [String]! @doc(description: "Values.") +input StoredAttributeInput { + attribute_uid: ID! @doc(description: "Attribute UID as attrbute code") + selected_attribute_values: [ID] + entered_attribute_values: [String] } type CustomerToken { @@ -82,7 +85,37 @@ input CustomerInput { gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") password: String @doc(description: "The customer's password") is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") - custom_attributes: [CustomAttributeInput] @doc(description: "Custom attributes.") + stored_attributes: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") +} + +input CustomerCreateInput { + prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") + firstname: String! @doc(description: "The customer's first name") + middlename: String @doc(description: "The customer's middle name") + lastname: String! @doc(description: "The customer's family name") + suffix: String @doc(description: "A value such as Sr., Jr., or III") + email: String! @doc(description: "The customer's email address. Required for customer creation") + dob: String @doc(description: "Deprecated: Use `date_of_birth` instead") + date_of_birth: String @doc(description: "The customer's date of birth") + taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") + gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") + password: String @doc(description: "The customer's password") + is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") + stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") +} + +input CustomerUpdateInput { + date_of_birth: String @doc(description: "The customer's date of birth") + dob: String @doc(description: "Deprecated: Use `date_of_birth` instead") + firstname: String @doc(description: "The customer's first name") + gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") + is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") + lastname: String @doc(description: "The customer's family name") + middlename: String @doc(description: "The customer's middle name") + prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") + suffix: String @doc(description: "A value such as Sr., Jr., or III") + taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") + stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") } type CustomerOutput { @@ -108,10 +141,10 @@ type Customer @doc(description: "Customer defines the customer name and address date_of_birth: String @doc(description: "The customer's date of birth") taxvat: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)") id: Int @doc(description: "The ID assigned to the customer") @deprecated(reason: "id is not needed as part of Customer because on server side it can be identified based on customer token used for authentication. There is no need to know customer ID on the client side.") - is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\IsSubscribed") - addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses") @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\CustomerAddresses") + is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") + addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses") gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") - custom_attributes: [CustomAttribute]! + stored_attributes: [StoredCustomAttribute]! @doc(description: "Stored custom attributes") } type CustomerAddress @doc(description: "CustomerAddress contains detailed information about a customer's billing and shipping addresses"){ @@ -136,11 +169,24 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform vat_id: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)") default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") - custom_attributes: [CustomerAddressAttribute] @deprecated(reason: "Use custom_attributes_v2 field.") - custom_attributes_v2: [CustomAttribute]! @doc(description: "Custom attributes.") + custom_attributes: [CustomerAddressAttribute] @deprecated(reason: "Use `stored_custom_attributes` instead.") + stored_attributes: [StoredAttribute]! @doc(description: "Stored custom attributes") extension_attributes: [CustomerAddressAttribute] @doc(description: "Address extension attributes") } +# See https://github.com/magento/architecture/blob/master/design-documents/graph-ql/custom-attributes-container.md +type StoredAttribute { + selected_attribute_values: [ID] + entered_attribute_values: [String] + attributes: [Attribute] +} + +type CustomAttribute { + uid: ID! + label: String! + values: [String]! @doc(description: "Array as container of values of the attribute. Can be string or JSON encoded") +} + type CustomerAddressRegion @doc(description: "CustomerAddressRegion defines the customer's state or province") { region_code: String @doc(description: "The address region code") region: String @doc(description: "The state or province name") diff --git a/design-documents/graph-ql/coverage/returns.graphqls b/design-documents/graph-ql/coverage/returns.graphqls index 8b4e00041..2bfca9522 100644 --- a/design-documents/graph-ql/coverage/returns.graphqls +++ b/design-documents/graph-ql/coverage/returns.graphqls @@ -119,19 +119,12 @@ type Return @doc(description: "Customer return") { type ReturnItem { uid: ID! order_item: OrderItemInterface! @doc(description: "Order item provides access to the product being returned, including selected/entered options information.") - custom_attributes: [CustomAttribute] @doc(description: "Return item custom attributes, which are marked by the admin to be visible on the storefront.") + stored_attributes: [StoredAttribute] @doc(description: "Return item custom attributes, which are marked by the admin to be visible on the storefront.") request_quantity: Float! @doc(description: "The quantity of the item requested to be returned.") quantity: Float! @doc(description: "The quantity of the items authorized by the merchant to be returned .") status: ReturnItemStatus! @doc(description: "The return status of the item being returned.") } -# See https://github.com/magento/architecture/blob/master/design-documents/graph-ql/custom-attributes-container.md -type CustomAttribute { - uid: ID! - label: String! - values: [String]! @doc(description: "JSON encoded value of the attribute.") -} - type ReturnComment { uid: ID! @doc(description: "Comment ID.") author_firstname: String! @doc(description: "First name of the user who posted the comment.") From 3d76c7a5602f37b44d93e95d0ed7053a8e4587eb Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Wed, 3 Feb 2021 19:16:52 -0600 Subject: [PATCH 3/7] - refactoring --- .../custom-attributes/attributes-metadata.md | 5 ++++- .../coverage/customer/customer.graphqls | 18 ++++++++---------- .../graph-ql/coverage/returns.graphqls | 8 -------- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md b/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md index 044bbb3ae..0ea3eec08 100644 --- a/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md +++ b/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md @@ -29,6 +29,7 @@ type CustomAttributeMetadata { } type Attribute { + uid: ID! attribute_code: String attribute_options: [AttributeOption] attribute_type: String @@ -38,8 +39,10 @@ type Attribute { } type AttributeOption { + uid: ID! label: String - value: String + value: String @deprecated(reason: "use `values` instead") + values: [ID]! @doc(description: "Array as container of values of the attribute") } ``` diff --git a/design-documents/graph-ql/coverage/customer/customer.graphqls b/design-documents/graph-ql/coverage/customer/customer.graphqls index 258674a6a..da3678553 100644 --- a/design-documents/graph-ql/coverage/customer/customer.graphqls +++ b/design-documents/graph-ql/coverage/customer/customer.graphqls @@ -63,9 +63,8 @@ input CustomerAddressAttributeInput { } input StoredAttributeInput { - attribute_uid: ID! @doc(description: "Attribute UID as attrbute code") - selected_attribute_values: [ID] - entered_attribute_values: [String] + selected_attribute_option_values: [ID!] + entered_attributes_values: [EnteredCustomAttributeInput] } type CustomerToken { @@ -176,15 +175,14 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform # See https://github.com/magento/architecture/blob/master/design-documents/graph-ql/custom-attributes-container.md type StoredAttribute { - selected_attribute_values: [ID] - entered_attribute_values: [String] - attributes: [Attribute] + selected_attributes_option_values: [ID] # unique value for attribute option + entered_attribute_values: [EnteredAttributeValue] + available_attributes: [Attribute] } -type CustomAttribute { - uid: ID! - label: String! - values: [String]! @doc(description: "Array as container of values of the attribute. Can be string or JSON encoded") +type EnteredAttributeValue { + attribute: Attribute + value: String } type CustomerAddressRegion @doc(description: "CustomerAddressRegion defines the customer's state or province") { diff --git a/design-documents/graph-ql/coverage/returns.graphqls b/design-documents/graph-ql/coverage/returns.graphqls index 2bfca9522..ceb420462 100644 --- a/design-documents/graph-ql/coverage/returns.graphqls +++ b/design-documents/graph-ql/coverage/returns.graphqls @@ -198,11 +198,3 @@ type StoreConfig { # sales_magento/rma/enabled returns_enabled: String! @doc(description: "Returns functionality status on the storefront: enabled/disabled.") } - -type Attribute { - uid: ID! -} - -type AttributeOption { - uid: ID! -} From 104a0b065617d8f79fa17426370b1573ebd81906 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Thu, 4 Feb 2021 21:33:00 -0600 Subject: [PATCH 4/7] refactoring namings --- .../custom-attributes/attributes-metadata.md | 3 +-- .../coverage/customer/customer.graphqls | 24 +++++++++++++------ .../graph-ql/coverage/returns.graphqls | 8 +++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md b/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md index 0ea3eec08..a4ca1df16 100644 --- a/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md +++ b/design-documents/graph-ql/coverage/custom-attributes/attributes-metadata.md @@ -40,9 +40,8 @@ type Attribute { type AttributeOption { uid: ID! + value: String @deprecated(reason: "use `uid` instead") label: String - value: String @deprecated(reason: "use `values` instead") - values: [ID]! @doc(description: "Array as container of values of the attribute") } ``` diff --git a/design-documents/graph-ql/coverage/customer/customer.graphqls b/design-documents/graph-ql/coverage/customer/customer.graphqls index da3678553..a9db21ac2 100644 --- a/design-documents/graph-ql/coverage/customer/customer.graphqls +++ b/design-documents/graph-ql/coverage/customer/customer.graphqls @@ -63,8 +63,13 @@ input CustomerAddressAttributeInput { } input StoredAttributeInput { - selected_attribute_option_values: [ID!] - entered_attributes_values: [EnteredCustomAttributeInput] + selected_attributes: [ID!] + entered_attributes: [EnteredAttributeInput] +} + +input EnteredAttributeInput { + attribute_uid: ID! + value: String! } type CustomerToken { @@ -84,7 +89,7 @@ input CustomerInput { gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") password: String @doc(description: "The customer's password") is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") - stored_attributes: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") + stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") } input CustomerCreateInput { @@ -143,7 +148,7 @@ type Customer @doc(description: "Customer defines the customer name and address is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses") gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") - stored_attributes: [StoredCustomAttribute]! @doc(description: "Stored custom attributes") + stored_attributes: [StoredAttribute]! @doc(description: "Stored custom attributes") } type CustomerAddress @doc(description: "CustomerAddress contains detailed information about a customer's billing and shipping addresses"){ @@ -175,12 +180,17 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform # See https://github.com/magento/architecture/blob/master/design-documents/graph-ql/custom-attributes-container.md type StoredAttribute { - selected_attributes_option_values: [ID] # unique value for attribute option - entered_attribute_values: [EnteredAttributeValue] + selected_attributes: [SelectedAttribute] # unique values for the attribute options + entered_attributes: [EnteredAttribute] available_attributes: [Attribute] } -type EnteredAttributeValue { +type SelectedAttribute { + attribute: Attribute + options_uids: [ID] +} + +type EnteredAttribute { attribute: Attribute value: String } diff --git a/design-documents/graph-ql/coverage/returns.graphqls b/design-documents/graph-ql/coverage/returns.graphqls index ceb420462..526f3aa7c 100644 --- a/design-documents/graph-ql/coverage/returns.graphqls +++ b/design-documents/graph-ql/coverage/returns.graphqls @@ -22,12 +22,12 @@ input RequestReturnInput { input RequestReturnItemInput { order_item_id: ID! @doc(description: "ID of the order item associated with the return.") quantity_to_return: Float! @doc(description: "The quantity of the item requested to be returned.") - selected_custom_attributes: [ID!] @doc(description: "Values of return item attributes defined by the merchant, e.g. select attributes.") - entered_custom_attributes: [EnteredCustomAttributeInput!] @doc(description: "Values of return item attributes defined by the merchant, e.g. file or text attributes.") + selected_attributes: [ID!] @doc(description: "Values of return item attributes defined by the merchant, e.g. select attributes.") + entered_attributes: [EnteredAttributeInput!] @doc(description: "Values of return item attributes defined by the merchant, e.g. file or text attributes.") } -input EnteredCustomAttributeInput { - uid: ID! +input EnteredAttributeInput { + attribute_uid: ID! value: String! } From 04badb939c5c62e8b90bd41d48c833da1b04355b Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Thu, 4 Mar 2021 21:18:19 -0600 Subject: [PATCH 5/7] - update customer output and input to use CustomAttribute and AttributeMetadataInterface --- .../coverage/customer/customer.graphqls | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/design-documents/graph-ql/coverage/customer/customer.graphqls b/design-documents/graph-ql/coverage/customer/customer.graphqls index a9db21ac2..3c807aada 100644 --- a/design-documents/graph-ql/coverage/customer/customer.graphqls +++ b/design-documents/graph-ql/coverage/customer/customer.graphqls @@ -47,8 +47,8 @@ input CustomerAddressInput { prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") suffix: String @doc(description: "A value such as Sr., Jr., or III") vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") - custom_attributes: [CustomerAddressAttributeInput] @deprecated(reason: "Use `stored_attributes`instead.") - stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") + custom_attributes: [CustomerAddressAttributeInput] @deprecated(reason: "Use `custom_attributes`instead.") + custom_attributes: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") } input CustomerAddressRegionInput @doc(description: "CustomerAddressRegionInput defines the customer's state or province") { @@ -62,13 +62,13 @@ input CustomerAddressAttributeInput { value: String! @doc(description: "Attribute value") } -input StoredAttributeInput { - selected_attributes: [ID!] +input CustomAttributeInput { + selected_attribute_options: [ID!] # this is a unique id that identifies a unique attribute option(value). It doesn't need an additional attribute uid. entered_attributes: [EnteredAttributeInput] } input EnteredAttributeInput { - attribute_uid: ID! + attribute_uid: ID! # since the value is string we need the attribute uid here. value: String! } @@ -89,7 +89,7 @@ input CustomerInput { gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") password: String @doc(description: "The customer's password") is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") - stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") + custom_attributes: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") } input CustomerCreateInput { @@ -105,7 +105,7 @@ input CustomerCreateInput { gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") password: String @doc(description: "The customer's password") is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") - stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") + custom_attributes: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") } input CustomerUpdateInput { @@ -119,7 +119,7 @@ input CustomerUpdateInput { prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") suffix: String @doc(description: "A value such as Sr., Jr., or III") taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") - stored_attributes: [StoredAttributeInput] @doc(description: "Stored custom attributes input.") + custom_attributes: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") } type CustomerOutput { @@ -148,7 +148,7 @@ type Customer @doc(description: "Customer defines the customer name and address is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter") addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses") gender: Int @doc(description: "The customer's gender (Male - 1, Female - 2)") - stored_attributes: [StoredAttribute]! @doc(description: "Stored custom attributes") + custom_attributes: [CustomAttribute]! @doc(description: "Stored custom attributes") } type CustomerAddress @doc(description: "CustomerAddress contains detailed information about a customer's billing and shipping addresses"){ @@ -174,24 +174,25 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") custom_attributes: [CustomerAddressAttribute] @deprecated(reason: "Use `stored_custom_attributes` instead.") - stored_attributes: [StoredAttribute]! @doc(description: "Stored custom attributes") + custom_attributes: [CustomAttribute]! @doc(description: "Stored custom attributes") extension_attributes: [CustomerAddressAttribute] @doc(description: "Address extension attributes") } # See https://github.com/magento/architecture/blob/master/design-documents/graph-ql/custom-attributes-container.md -type StoredAttribute { - selected_attributes: [SelectedAttribute] # unique values for the attribute options - entered_attributes: [EnteredAttribute] - available_attributes: [Attribute] +# See https://github.com/magento/architecture/blob/master/design-documents/graph-ql/attributes-metadata.md +type CustomAttribute { + selected_attribute_options: [SelectedAttributeOption] # unique value for attribute option + entered_attribute_value: EnteredAttributeValue + attribute_metadata: AttributeMetadataInterface # used to get full metadata info and avoid another query to customAttributeMetadata } -type SelectedAttribute { - attribute: Attribute - options_uids: [ID] +type SelectedAttributeOption { + attribute_option: AttributeOptionInterface + attribute_metadata: AttributeMetadataInterface } -type EnteredAttribute { - attribute: Attribute +type EnteredAttributeValue { + attribute_metadata: AttributeMetadataInterface value: String } From 0b95919e643ac81b91194bc28a74fb8c8b2ae49c Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Thu, 4 Mar 2021 21:33:14 -0600 Subject: [PATCH 6/7] - rename back custom attribute --- design-documents/graph-ql/coverage/customer/customer.graphqls | 4 ++-- design-documents/graph-ql/coverage/returns.graphqls | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/design-documents/graph-ql/coverage/customer/customer.graphqls b/design-documents/graph-ql/coverage/customer/customer.graphqls index 3c807aada..e4a124e5f 100644 --- a/design-documents/graph-ql/coverage/customer/customer.graphqls +++ b/design-documents/graph-ql/coverage/customer/customer.graphqls @@ -173,8 +173,8 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform vat_id: String @doc(description: "The customer's Value-added tax (VAT) number (for corporate customers)") default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") - custom_attributes: [CustomerAddressAttribute] @deprecated(reason: "Use `stored_custom_attributes` instead.") - custom_attributes: [CustomAttribute]! @doc(description: "Stored custom attributes") + custom_attributes: [CustomerAddressAttribute] @deprecated(reason: "Use `custom_attributesV2` instead.") + custom_attributes_v2: [CustomAttribute]! @doc(description: "Stored custom attributes") extension_attributes: [CustomerAddressAttribute] @doc(description: "Address extension attributes") } diff --git a/design-documents/graph-ql/coverage/returns.graphqls b/design-documents/graph-ql/coverage/returns.graphqls index 526f3aa7c..a9aeb3333 100644 --- a/design-documents/graph-ql/coverage/returns.graphqls +++ b/design-documents/graph-ql/coverage/returns.graphqls @@ -119,7 +119,7 @@ type Return @doc(description: "Customer return") { type ReturnItem { uid: ID! order_item: OrderItemInterface! @doc(description: "Order item provides access to the product being returned, including selected/entered options information.") - stored_attributes: [StoredAttribute] @doc(description: "Return item custom attributes, which are marked by the admin to be visible on the storefront.") + custom_attributes: [CustomAttribute]! @doc(description: "Return item custom attributes, which are marked by the admin to be visible on the storefront.") request_quantity: Float! @doc(description: "The quantity of the item requested to be returned.") quantity: Float! @doc(description: "The quantity of the items authorized by the merchant to be returned .") status: ReturnItemStatus! @doc(description: "The return status of the item being returned.") From 5afb38fea6fa21547b1b07d235a469ddfc614874 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Fri, 12 Mar 2021 21:31:38 -0600 Subject: [PATCH 7/7] rename field --- design-documents/graph-ql/coverage/customer/customer.graphqls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/design-documents/graph-ql/coverage/customer/customer.graphqls b/design-documents/graph-ql/coverage/customer/customer.graphqls index e4a124e5f..93359ef90 100644 --- a/design-documents/graph-ql/coverage/customer/customer.graphqls +++ b/design-documents/graph-ql/coverage/customer/customer.graphqls @@ -48,7 +48,7 @@ input CustomerAddressInput { suffix: String @doc(description: "A value such as Sr., Jr., or III") vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") custom_attributes: [CustomerAddressAttributeInput] @deprecated(reason: "Use `custom_attributes`instead.") - custom_attributes: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") + custom_attributes_v2: [CustomAttributeInput] @doc(description: "Stored custom attributes input.") } input CustomerAddressRegionInput @doc(description: "CustomerAddressRegionInput defines the customer's state or province") {