[BUG] The type of options
parameter of searchProductVariantIds
is incorrect
#1630
Labels
options
parameter of searchProductVariantIds
is incorrect
#1630
Current Behavior
Here: https://github.com/shopware/frontends/blob/main/templates/vue-demo-store/api-types/storeApiTypes.d.ts#L9442 the type of
options
is defined asstring[]
. This is the type generated based on the openAPI specification of this endpoint. While this type is technically correct for PHP, it's not for Typescript.From the code of
FindProductVariantRoute.php
you can see that the$options
parameter can be also a map ofgroupId => optionId
.It is very confusing, we had a bug on our storefront, where we expected the variant to be switched to the first available option in the different color, but instead we were getting the response that variant was not found. Only after debugging the Shopware controller we found that we should just ignore the type of
string[]
and pass theoptions
asgroupId => optionId
Expected Behavior
The type for
body.options
ofsearchProductVariantIds
action is defined asRecord<string, string>
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: