Open
Description
Preconditions and environment
- Magento version 2.4.7-p2
- A GraphQL client like Altair
- A Magento instance with data
Steps to reproduce
The following GraphQL query is used to retrieve information about products and layered navigation filters:
{
products(filter: {}) {
aggregations {
attribute_code
count
label
position
options {
label
value
count,
swatch {
type,
value
}
}
}
items {
id
categories {
id
is_anchor
}
name
sku
image {
url
label
}
related_products {
id
name
}
crosssell_products {
id
name
}
upsell_products {
id
name
}
price_range {
minimum_price {
regular_price {
value
currency
}
}
}
}
page_info {
page_size
}
}
}
Where aggregations->options->swatch
has been defined as an extension of AggregationOptionInterface
in the file <module>/etc/schema.graphqls
:
interface AggregationOptionInterface
{
swatch: Swatch @doc(description: "Information required to render filter swatches")
}
type Swatch
{
type: String @doc(description: "Type of swatch (0 - text, 1 - color, 2 - image)")
value: String @doc(description: "Value for swatch (text, color value or image link)")
}
Expected result
The swatch information is returned as an array with 2 members (value
and label
), as defined in <module>/etc/schema.graphqls
:
{
"data": {
"products": {
"aggregations": [
{
"attribute_code": "background_color",
"count": 10,
"label": "Background Color",
"position": 8,
"options": [
{
"label": "Purple",
"value": "purple",
"count": 2,
"swatch": [
"value": "https://images.com/purple.png", <---------- correct situation,
"label": "image" <---------- array with members
]
},
...
]
}
]
}
}
}
Actual result
The swatch information which should be an array with 2 members, is converted to null
whenever I query the GraphQL api:
{
"data": {
"products": {
"aggregations": [
{
"attribute_code": "background_color",
"count": 10,
"label": "Background Color",
"position": 8,
"options": [
{
"label": "Purple",
"value": "purple",
"count": 2,
"swatch": null <--------- the array has been converted to null!
},
...
]
}
]
}
}
}
Additional information
I have no additional information.
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.