Add has_options and required_options to GraphQL ProductInterface (#32793) - #41215
Open
lbajsarowicz wants to merge 5 commits into
Open
Add has_options and required_options to GraphQL ProductInterface (#32793)#41215lbajsarowicz wants to merge 5 commits into
lbajsarowicz wants to merge 5 commits into
Conversation
The fixture product carries three required custom options, so both fields must resolve to true, not merely be present in the response.
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
5 tasks
Contributor
Author
|
@magento run Static Tests |
The product_simple_with_custom_options fixture saves its stock item with is_in_stock = 2 and is never picked up by the search index, so the products query returned no items in the WebAPI build. product_with_options is the fixture the existing customizable-options GraphQL test already queries the same way; it also carries required options.
Contributor
Author
|
@magento run all tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (*)
Continues #33125 by @karyna-t (Atwix), which was approved by two maintainers in July 2021 and never merged. The branch fell behind
2.4-developand conflicted onschema.graphqls; this PR carries the original commits rebased onto the current base.has_optionsandrequired_optionsare columns ofcatalog_product_entityand are exposed throughProductInterfacein REST, but not in GraphQL. Theproductsfilter and sort inputs already accept both fields, so a client can filter by them without being able to read them back. This adds both asBooleanfields onProductInterface. No resolver is needed: the product model already carries the values from the collection load.Changes on top of the original PR:
2.4-develop, conflict inProductInterfaceresolved (the fields now followcustom_attributesV2)true/truefor the fixture product with three required custom options), not only the presence of the keys@cpartica asked in the original review whether this belongs on
CustomizableProductInterfaceinstead. The two columns exist on every product type (bundles and configurables setrequired_optionswithout custom options), and the filter and sort inputs already expose them on the genericProductInterface, so placing the output fields on the same interface keeps the schema consistent.Related Pull Requests
Fixed Issues (if relevant)
has_optionsandrequired_optionsare not available in GraphQL #32793Manual testing scenarios (*)
{ products(filter: {sku: {eq: "<sku>"}}) { items { sku has_options required_options } } }to/graphqltrue; for a product without options both resolve tofalseQuestions or comments
Gates run locally on the rebased branch: PHPCS on the test file is clean, Static Tests (LiveCodeTest) result is reported in the first comment. The API-functional test needs the WebAPI build; please run it here.
The Semantic Version Checker will flag the two added interface fields as a minor GraphQL schema change (additive only).
Contribution checklist (*)