Skip to content

Input type of customizable option doesn't get returned through GraphQL #29302

Closed
@drpayyne

Description

@drpayyne

Preconditions

Github branches magento2/2.4-develop and architecture/master

Steps to reproduce

The GraphQL type SelectedCustomizableOption is used in multiple places across the Magento GraphQL modules to get the currently selected customizable option of a product through GraphQL. There are various field types for this such as text, textarea, select, multiselect, checkbox, etc. Currently, there's no way for a frontend using GraphQL to know how to render the SelectedCustomizableOption. Yes, the format varies according to different types, but the format is the same for input types of the same category. I believe there's no way to differentiate between a text and a textarea of SelectedCustomizableOption. Same with the different select input types.

The associated resolver class does return the 'type of input' from Magento (ref: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/QuoteGraphQl/Model/CartItem/DataProvider/CustomizableOption.php#L60), but the associated GraphQL schema does not define a field for the same (ref: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/QuoteGraphQl/etc/schema.graphqls#L346) and hence the 'type of input' doesn't get returned.

Upon some searching, the GraphQL coverage docs did have the 'type of input' as a field in SelectedCustomizableOption a couple of months ago (ref: https://github.com/magento/architecture/blob/673438109bbf63d819e96c373ef7622206ff7f9b/design-documents/graph-ql/coverage/add-items-to-cart/AddSimpleProductToCart.graphqls#L59) until the new coverage docs (ref: https://github.com/magento/architecture/blob/master/design-documents/graph-ql/coverage/Cart.graphqls#L114) was matched according to the current GraphQL schema and was thus, removed.

Expected result

Consistency.

Is the field type required to render the input type on the frontend?

  • If yes, we need to add the field back to the schema.
  • If not, we need to remove it from the resolver for consistency and to avoid confusion for developers in the future.

Actual result

The field type was removed from the QuoteGraphQl module in this commit: 1315577#diff-795a33fde881f18aba5165a5a8c7513fL317 and from the architecture coverage docs a couple months ago and now the code is inconsistent and causes confusion for developers.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • 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”.

Metadata

Metadata

Assignees

Labels

Component: QuoteGraphQlFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Format is validGate 1 Passed. Automatic verification of issue format passedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneProject: GraphQL

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions