Update proposal for custom attributes schema#456
Update proposal for custom attributes schema#456melnikovi wants to merge 12 commits intomagento:masterfrom
Conversation
… with multiple values
… with multiple values
|
@melnikovi Does this align with the custom attribute proposal from @akaplya for Product? #429 |
| To account for dynamic nature of EAV attributes and the need of "getting all fields" in product search queries,we can introduce `custom_attributes: [CustomAttribute]!` container. | ||
|
|
||
| ```graphql | ||
| type CustomAttribute { |
There was a problem hiding this comment.
I think we have to add "type" opinion here to be able to render the appropriate template (datetime, text, multi-select, checkbox ...)
E.g.
"attributes":[
{
"code":"multiselect_attribute",
"type":"multiselect",
"values":[
"Option 1",
"Option 2"
]
}
]
There was a problem hiding this comment.
Attributes are going to be displayed as information and not as fields you can control, so I don't think it's necessary.
There was a problem hiding this comment.
it will be useful to render field properly on UI without complex logic. E.g. for "Date" field - "10-11-2020"
There was a problem hiding this comment.
yes, they are needed for the forms
There was a problem hiding this comment.
We have this data already available in the scope of customAttributeMetadata query. Since update frequency for attribute metadata and product attribute values is different, it makes sense to separate them to avoid excessive payload size.
… with multiple values
| code: String! | ||
| } | ||
|
|
||
| type SingleValueCustomAttribute extends CustomAttributeInterface { |
There was a problem hiding this comment.
even if this adds more complexity, it's the graphql way to do it and I prefer it
| # Proposed solution | ||
|
|
||
| To account for dynamic nature of EAV attributes and the need of "getting all fields" in product search queries, `custom_attributes: [CustomAttribute]!` container will be introduced. | ||
| To account for dynamic nature of EAV attributes and the need of "getting all fields" in product search queries, we can introduce `custom_attributes: [CustomAttribute]!` container (recommended approach). |
There was a problem hiding this comment.
do fragments bring any value for PWA since we still prefer these flat single structure arrays vs infterfaces?
| @@ -0,0 +1,222 @@ | |||
| type Query { | |||
| customAttributeMetadataV2(attributes: [AttributeMetadataInput!]!): CustomAttributeMetadata | |||
| customAttributesLists(listType: CustomAttributesListsEnum): CustomAttributeMetadata | |||
There was a problem hiding this comment.
customAttributesLists - do we need a better name for this
|
Problem
Current schema for custom attributes doesn't support attributes that can have multiple values (checkbox, multiselect).
Solution
Requested Reviewers