Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of custom attributes values for entities like customer/product/address #458

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

melnikovi
Copy link
Member

Problem

Support of custom attributes for customer and customer address.

Solution

Requested Reviewers

@melnikovi melnikovi added GraphQL needs update Author should update the proposal based on the feedback labels Oct 22, 2020
@cpartica cpartica changed the title Support of custom attributes for customer and customer address Support of custom attributes for customer and inlined with customer address Jan 19, 2021
-adding entered and selected values
@@ -59,6 +60,11 @@ input CustomerAddressAttributeInput {
value: String! @doc(description: "Attribute value")
}

input CustomAttributeInput {
attribute_code: String! @doc(description: "Code.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to uid

@@ -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.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this array CAN be empty, but we always have to return an array if no attribute are defined

CustomAttribute doesn't contain the same amount of data as Attribute from EAV
Eav includes CustomAttribute. Complex Eav values could be expressed as JSON like tier price

We need to show both pieces of information to avoid a round trip to customAttributeMetadata

  • selected_options/entered_options
  • the whole info from customAttributeMetadata on each available attribute

`stored_attributes_v2: [StoredAttribute]

type StoredAttribute {
atttribute_uid
selected_attribute_values: [ID]
entered_attribute_values: [String]
attributes: [Attribute]
}
`

@@ -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.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this defined on the returns. this belongs in the EAV module

@@ -129,7 +129,7 @@ type ReturnItem {
type CustomAttribute {
uid: ID!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably have to deprecte this in favor of CustomAttributeV2

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

label: String
value: String
value: String @deprecated(reason: "use `values` instead")
values: [ID]! @doc(description: "Array as container of values of the attribute")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be sufficient for single and multiple values

@@ -128,10 +168,23 @@ 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 `stored_custom_attributes` instead.")
Copy link
Contributor

@cpartica cpartica Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to reuse Attribute from the Metadata query.
Using the already popular and known term "custom_attributes", It’s not very clear that this will return all information about the storefront dedicated attributes and their options and values (not sure about the options part)
but also this type has to contain the stored( saved )by the user values. Same are used on the input as well. The difference is the output contains full meta of the attribute + picked values and input only contains references of the attribute and picked values

If introducing a new term to favor better naming, we can restore custom_attributes and introduce custom_attributes_v2

@cpartica cpartica changed the title Support of custom attributes for customer and inlined with customer address Support of custom attributes values for entities like customer/product/address May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-guild GraphQL needs update Author should update the proposal based on the feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants