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

[BUG] The type of options parameter of searchProductVariantIds is incorrect #1630

Open
krzysztofkaszanek opened this issue Jan 23, 2025 · 0 comments
Labels
bug Something isn't working OpenAPI-schema

Comments

@krzysztofkaszanek
Copy link

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 as string[]. 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 of groupId => 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 the options as groupId => optionId

Expected Behavior

The type for body.options of searchProductVariantIds action is defined as Record<string, string>

Steps To Reproduce

No response

Anything else?

No response

@krzysztofkaszanek krzysztofkaszanek added the bug Something isn't working label Jan 23, 2025
@mkucmus mkucmus moved this from No status to Developer Backlog in Composable Frontends Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OpenAPI-schema
Projects
Status: Developer Backlog
Development

No branches or pull requests

2 participants