magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.57k stars 9.32k forks source link

[EY] Routable Interface in GraphQL #31196

Closed magento-engcom-team closed 3 years ago

magento-engcom-team commented 3 years ago

More info here. https://github.com/magento/architecture/blob/898049e0834d7a07e4a9ee500937c011a111aa99/design-documents/graph-ql/coverage/storefront-route.md

Acceptance Criteria:

Add a RoutableInterface to the base schema, and require all entity types which are routable to implement it.

A subset of Magento entities is "routable", in that they have URLs and they serve as the model for a rendered page. The natural fit for this concept is an interface, and GraphQL provides multiple interfaces (http://spec.graphql.org/June2018/#sec-Objects) so that a given type can implement more than one.

As described in Requirements (https://github.com/magento/architecture/blob/898049e0834d7a07e4a9ee500937c011a111aa99/design-documents/graph-ql/coverage/storefront-route.md#requirements), the PWA must have the entity type and entity data for a given route, and it should be able to query for display metadata for that route. A GraphQL interface is a good match for these requirements:

Get the entity type using __typename introspection to get the GraphQL concrete type of the RoutableInterface

Get the entity data from the same RoutableInterface using GraphQL fragments on concrete type conditions

Get optional display metadata by requiring that field in the RoutableInterface

Notes:

An uncached response from the urlResolver query, in Magento cloud, takes around ~200ms to complete.

This change would provide the following benefits:

  1. No need to make a 2nd, follow-up request for entity, so client doesn't pay the cost of Magento Framework bootstrap 2x
  2. Querying of entity data happens at least 200ms earlier in page load
magento-engcom-team commented 3 years ago

The issue was exported from the internal JIRA. The link to the original JIRA issue: https://jira.corp.magento.com/browse/MC-39746

m2-assistant[bot] commented 3 years ago

Hi @magento-engcom-team. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

KrishnaK-Z commented 3 years ago

@magento I am working on this