Giter Site home page Giter Site logo

magento / graphql-ce Goto Github PK

View Code? Open in Web Editor NEW
132.0 468.0 160.0 436.93 MB

[ARCHIVED] Please use magento/magento2 project

Home Page: https://github.com/magento/magento2

License: Open Software License 3.0

PHP 82.25% JavaScript 5.47% HTML 8.83% CSS 3.41% VCL 0.02% Shell 0.01%

graphql-ce's Introduction

Open Source Helpers Gitter Crowdin

Welcome

Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.

Magento System Requirements

Magento System Requirements.

Install Magento

Learn More About GraphQL in Magento 2

Contributing to the Magento 2 Code Base

Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.

To learn about how to contribute, click here.

To learn about issues, click here. To open an issue, click here.

To suggest documentation improvements, click here.

Community Maintainers

The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks to these Community Maintainers for their valuable contributions.

Top Contributors

Magento is thankful for any contribution that can improve our codebase, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.

Labels Applied by the Magento Team

We apply labels to public Pull Requests and Issues to help other participants retrieve additional information about current progress, component assignments, Magento release lines, and much more. Please review the Code Contributions guide for detailed information on labels used in Magento 2 repositories.

Reporting Security Issues

To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the Magento Bug Bounty Program on hackerone. Please create a hackerone account there to submit and follow-up on your issue.

Stay up-to-date on the latest security news and patches for Magento by signing up for Security Alert Notifications.

License

Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license.

Open Software License (OSL 3.0). Please see LICENSE.txt for the full text of the OSL 3.0 license or contact [email protected] for a copy.

Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file. Please see LICENSE_EE.txt for the full text of the MEE License or visit https://magento.com/legal/terms/enterprise.

Community Engineering Slack

To connect with Magento and the Community, join us on the Magento Community Engineering Slack. If you are interested in joining Slack, or a specific channel, send us a request at [email protected] or self signup.

We have channels for each project. These channels are recommended for new members:

  • general: Open chat for introductions and Magento 2 questions
  • github: Support for GitHub issues, pull requests, and processes
  • public-backlog: Discussions of the Magento 2 backlog

graphql-ce's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-ce's Issues

Category filtering

The category query should include a filter argument, similar to the products query. It should achieve parity with the REST API's search criteria functionality on category entities.

AC

  • User is able to filter categories by
    • id
    • name
    • description
    • isAnchor: return only categories that are isAnchor=yes or isAnchor=no
    • level: return only categories that are on the specified level in the tree
    • parentId: return only direct children of the specified parent category
  • Endpoint accepts new filter criteria, and returns an array of matching CategoryTree objects

References:

Expected result

  1. It is possible to filter categories based on filterable attributes in a category query.
  2. Functionality is covered by automated api-functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[My Account] Manage Address Book

As a Magento developer, I need to build a functional My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using only GraphQL.

GraphQL needs to provide sufficient mutations (ways to create/update/delete data) for a developer to build out the storefront My Account experience for a shopper.

Use cases:

  • A logged-in shopper can manage their address book from the My Account Page
  • This user can add addresses, change addresses, and remove addresses

Acceptance criteria:

  • GraphQL provides a mutation through which the current logged-in shopper can manage their address book
  • Authentication is handled through a session cookie (changing the email address requires that current password is provided)
  • A guest shopper cannot change the address book for any user
  • User can remove an address only if this address is not the default shipping or billing address
  • Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

My Account area impacted:

  • Address Book tab
    image
    image

[Query] My Account > Stored Payment Methods

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
Stored Payment Methods

image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Add category children depth parameter

As a Magento developer, I want to control the depth of the returned children for the requested category so that my queries can be more performant.

Acceptance criteria

  1. Depth = 0 returns all children (default)
  2. Depth = 1 returns only immediate children
  3. Depth = 2 returns only immediate children and their children; and so on
  4. Children are returned in a flat list (depth can be determined by "level" field)
  5. Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Return full canonical product URL within product object

As a Magento developer, I want GraphQL product data to include the canonical product URL so that it's easy for me to render links to any product.

Canonical URL resolution is already implemented in \Magento\UrlRewriteGraphQl\Model\Resolver\UrlRewrite::resolve, which can be used a reference.

See how to expose a new query via GraphQL in Magento

Acceptance criteria:

  1. canonical_url field is added to ProductInterface GraphQL interface. See Magento/CatalogGraphQl/etc/schema.graphqls
  2. Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Query] My Account > My Orders

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
My Orders
image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

My Account

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:

  • My Orders
  • Wishlists
  • Stored payment methods
  • Gift cards
  • Rewards balance
  • Gift registries
  • Product reviews

[Checkout coverage] Place order

As a Magento developer, I need to create and modify orders via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using only GraphQL.

GraphQL needs to provide sufficient mutations for a developer to enable order placement for shoppers. Creating and modifying the Cart object will be done in Cart Operations story

Use cases:

  • Guest and registered shoppers can place orders during checkout
  • Registered shoppers can "reorder" from their past orders in My Account

Acceptance criteria:

Storefront areas impacted:

  • Checkout

My Account

As a Magento developer, I want GraphQL to return sufficient data for me to build a My Account experience entirely in GraphQL so that I can complete my development faster and not have to switch technologies while building a storefront.

High level scenarios
For a logged in customer, GraphQL can provide required data to render:

  • My Orders
  • Wishlists
  • Downloadable products
  • Stored payment methods
  • Store credit
  • Gift cards
  • Billing agreements
  • Rewards: balance, history, and email preferences
  • Gift registries
  • Product reviews
  • Order by SKU
  • Newsletter subscription list
  • Invitation list

Assumptions:

  • Contact info, general newsletter preference, and address book data can already be retrieved

[Cart Operations] Manage Cart Items

As a Magento developer, I need to manipulate the shopping cart via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using only GraphQL.

GraphQL needs to provide sufficient mutations (ways to create/update/delete data) for a developer to build out the storefront checkout experience for a shopper.

Use cases:

  • Both guest and registered shoppers can add new items to cart
  • Both guest and registered shoppers can update item qty in cart
  • Both guest and registered shoppers can remove items from cart
  • Both guest and registered shoppers can update the configuration (for a configurable product) or quantity of a previously added configurable product in cart
    • Edit Item link > Product page > Update configuration or qty > Update Cart

Acceptance criteria:

  • Cart operations should be useable in both standard Cart and mini-cart
  • GraphQL provides the following mutations:
    • addCartItems
    • updateCartItems
    • removeCartItems
  • updateCartItems mutation allows the cart item quantity to be updated in a shopper's cart
  • All product types are supported in a modular way (e.g. configurable-related schema and resolvers must be declared in ConfigurableProductGraphQl module and the rest of the system should still work if this module is disabled)
  • Depending on token in Authorization header (if any), customer or guest service contract should be used
  • Changes are covered with web API functional tests. See \Magento\GraphQl\TestModule\GraphQlMutationTest::testMutation as an example.

Proposed schema

My Account area impacted:

  • Cart
  • Minicart

[Prototype] Server-side query caching

Varnish:

  1. Start accepting GraphQL queries as GET requests
    • see proposal from @paales in comments
    • example, http://magento.api/graphql?query={queryName{fieldName}}. The whole query goes to the URL
    • enables caching with Varnish without new dependencies
    • caching will not work with GraphQL queries sent as POST requests
    • requires slight modification of existing Magento GraphQL framework to start accepting GET requests
    • recommended by https://graphql.org/learn/serving-over-http

Use cases that should be supported

  1. Products query contains a list of category assignments. In this case when the category is changed the product cache must be invalidated. If products query didn't contain category assignment, then changes in the category must not affect the product cache.
  2. Queries, which contain search criteria may get outdated when the new products are added or any product in the system is modified. Cache should be invalidated in this case.

Prototype

https://github.com/magento/graphql-ce/tree/GraphQL-Cache-Prototype
Has the following concepts tested:

  • GraphQL queries via HTTP GET
  • Generation of Varnish tags in a modular way without direct modifications of the resolvers
  • Caching of product queries and invalidation on related product updates

Considered alternatives

  1. Implement Varnish support for POST requests

[Checkout coverage] Manage Shipping methods on Cart

As a Magento developer, I need to set and manage the selected shipping method on cart to support checkout via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end.

Use Cases

High Level I/O

  • Render available shipping methods on storefront
    • Input: saved address (id) or custom/new address
    • Output: available shipping methods
  • Set and be able to modify the shipping method on the cart
    • Input: shipping carrier (code), shipping method (code)
    • Output: current cart
  • Request the currently set shipping method on cart
    • Input: current cart
    • Output: currently set shipping method

TO DO

  • find exact address fields that need to be provided in order to estimate OOTB shipping methods

Return 'Available sort options' for product listing

There is “Product Listing Sort By“ setting in the Magento’s catalog configuration. These options (e.g. Position, Name, Price asc/desc) are used to change default sorting in product listing. And these options are necessary to render the toolbar on the client side. Of course those options could be written as an JS variable during HTML server side rendering but it would be more convenient to get them together with the pagination information.

See how to expose a new query via GraphQL in Magento

Acceptance criteria:

  1. sort_fields field should be added to Products GraphQL type (see Magento/CatalogGraphQl/etc/schema.graphqls )
  2. Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Limit list of filterable product fields

Currently the list of filterable fields includes fields that we decided should not be returned by the storefront API, so they need to unavailable to filter by:

General

  • old_id
  • visibility (this is being used in Deepty's tests)
  • weight_type

Catalog, but not simple or configurable products

  • shipment_type
  • sku_type
  • tax_class_id
  • category_ids
  • samples_title
  • links_title
  • links_exist

Price-related

  • cost
  • minimal price
  • msrp
  • msrp_display_actual_price_type
  • price_type

Changes should be covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Implement query complexity limiting

As a Magento developer, I want query complexity limiting within the GraphQL framework so that my store is not vulnerable to attack by issuance of highly complex queries to my GraphQL server.

Acceptance Criteria

  1. A recommendation for query complexity threshold is established
  2. Query complexity threshold is implemented
  3. Queries above the complexity threshold are rejected with appropriate error message
  4. Queries below the complexity threshold are processed appropriately
  5. Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

References

[Mutations] My Account > Change account information

As a Magento developer, I need to build a functional My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using only GraphQL.

GraphQL needs to provide sufficient mutations (ways to create/update/delete data) for a developer to build out the storefront My Account experience for a shopper.

Use cases:

  • A logged-in shopper can change their account information from the My Account Page

Acceptance criteria:

  • GraphQL provides a mutation through which the current logged-in shopper can change their account information
  • Authentication is handled through a session cookie (changing the email address requires that current password is provided)
  • A guest shopper cannot change the account information for any user
  • A meaningful error message is given if current password is incorrect or if entered data does not conform to requirements
  • List of fields that can be changed:
    • First Name
    • Last Name
    • Email address (requires current password)
  • Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.
  • Please propose GraphQL schema before starting implementation

My Account area impacted:

  • Account Information tab

Note: will likely merge #56 into this story

[Query] My Account > My Wish List

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
My Wish List
image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Checkout coverage] Manage Payments data on Cart

As a Magento developer, I need to perform sufficient payment operations to support checkout via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end.

Use Cases

  • Render available payment methods on storefront
  • Set a payment method on the cart
  • Submit payment info to payment provider as part of checkout
  • Redeeming reward points or store credit

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Query] My Account > My Invitations

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
My Invitations

image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Cart Operations] Fetch guest shopper cart

As a Magento developer, I need to fetch the shopping cart via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using only GraphQL.

As an initial iteration of GraphQL support for cart, expose guest cart query using resolver based on service contracts.

References:

Acceptance Criteria:

  1. It is possible, using GraphQL, to query information about the cart created via REST APIs
  2. Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.
  3. Appropriate documentation is updated in DevDocs

[Mutations] My Account > Newsletter Subsciption

As a Magento developer, I need to build a functional My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using only GraphQL.

GraphQL needs to provide sufficient mutations (ways to create/update/delete data) for a developer to build out the storefront My Account experience for a shopper.

Use cases:

  • A logged-in shopper can change their newsletter subscription preference from the My Account Page

Acceptance criteria:

  • GraphQL provides a mutation through which the current logged-in shopper can subscribe or unsubscribe from any newsletter
  • Authentication is handled through a session cookie
  • A guest shopper cannot change the account information for any user
  • Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

My Account area impacted:

  • Newsletter Subscriptions tab
    image

Note: functionality is closely related to issue #55 since they both modify the customer record

Enable GraphQL text fields to contain WYSIWYG/Pagebuilder content (as complex object)

As a developer I want be able to add different response format for content fields in product, CMS, and Category API. Currently the API returns simple type (string), but in the future we may want to return HTML and/or JSON for more convenient processing by web apps.

Acceptance Criteria

  • Modify all fields of type textarea in Products GraphQL API to return an object instead of simple type so later data can be extended and retrieved in JSON format.
  • Add a new attribute named format within each object, with two possible values (for now): html and json (potentially to be expanded later)
  • By default complex object contains only string format, property value is html
  • It is not necessary to modify the responses to return json values in the scope of this story
  • Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Example
Before

type ProductInterface {
...
name: String
...
}

After

type ProductInterface {
   ...
   name: ComplexTextValue
   ...
}

type ComplexTextValue {
   html: String!   
   # this list can be expanded later, like adding json format 
}

CMS block coverage

As a Magento Developer, I want to query for CMS block content using the GraphQL API so that I can build basic ecommerce storefronts using only GraphQL for efficiency.

Use cases:

  • Developer can query GraphQL for CMS block content and get back all necessary data to render the page on storefront or in 3rd party applications.

Acceptance Criteria

  • Only enabled blocks will be returned by the API
  • Store view context is passed in the HTTP header and only blocks relevant to given context will be returned
  • Staging versions of the page cannot be queried - only the currently active blocks are returned
  • [DRAFT] API returns the following info
    • title
    • identifier
    • rendered (with no Magento-specific directives) or un-rendered block content, depending on configuration

Changes should be covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Query] My Account > Gift Registry

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
Gift Registry
image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Return product stock data

As a Magento developer, I want to access relevant stock data with products in one query so that I can render related data efficiently and correctly on storefront.

Use cases

  • Distinguish between "in-stock" and "out-of-stock" products on storefront (if "display out-of-stock products = Yes)
  • Show "Only X Left" or "Low Stock" on PDP or PLP when the product's stock is below the configured threshold (Catalog > Inventory > Stock Options)

Acceptance criteria

  1. A dedicated field on product that designates if the product is in stock or not
  2. A dedicated field on product that designates if it's below the configured threshold and how much stock is left (if configured)
  3. Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Query] My Account > My Product Reviews

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
My Product Reviews

image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[My Account] My Downloadable Products

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
My Downloadable Products
image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Itemized WEEE tax

We had some problems on the way adjustments are implemented with weee, it sums up together all weee. So but if we want to see what tax is per individual weee tax attribute we can't only all weee. We can in theory only read wee separately as an attribute outside prices and display it's values. The problem is it's not being populated as it's of type string so we need a GraphQL module/story to handle weee properly and fix adjustments somehow to handle all display settings on weee as it has more display settings than a simple tax include/exclude

Need to continue conversation on testing this func (48 combinations)

Currently works the same as how pricing/tax API works; if it changes in the future, it'll break GraphQL.

Changes should be covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

CMS page coverage

As a Magento Developer, I want to query for CMS page content using the GraphQL API so that I can build basic ecommerce storefronts using only GraphQL

Use cases:

  • Developer can query GraphQL for CMS page content and get back all necessary data to render the page on storefront or in 3rd party applications.

Acceptance Criteria

  • Only enabled pages will be returned by the API
  • Store view context is passed in the HTTP header and only pages relevant to given context will be returned
  • Staging versions of the page cannot be queried - only the currently active pages are returned
  • [DRAFT] API returns the following info
    • url or url key
    • layout
    • layout update XML?
    • theme?
    • page title
    • content heading
    • rendered (with no Magento-specific directives) or un-rendered page content, depending on configuration
    • meta title, keywords, description
    • parent page(s)

Changes should be covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Checkout coverage

As a Magento developer, I need to perform checkout operations via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end.

High Level use cases

  • Cart manipulations
    -- Fetch user's cart
    -- Manage user's cart (addresses, items, qty, shipping, billing, payment details)
    -- Convert cart to order
  • Set Payment method
  • Set Shipping method

High Level approach to SDL

  1. First build an API on top of current stack
  2. Iterate to query on arbitrary attributes
  3. Iterate to make it performant
  4. Write tests that cover the desired end state
  5. Write performance tests
  6. Write unit tests
  7. Write end-to-end tests

Include 'products' in category query

As a Magento developer, I want to access the "products" directly from any category object so that it's easy for me to render products belonging to a category from that category object.

Acceptance criteria

  1. User can access products belonging to a category from that category object
  2. There is a default limit on how many products are shown at a time so that performance is not hindered
  3. User can access products beyond than those included in the default set by changing pagination or default pagesize
  4. At least the following data is available:
    • name
    • sku
    • product_type
    • description
    • short_description
    • media_gallery_entries (default medium or thumbnail image)
    • price (final calculated price)
    • review rating
    • custom_attribute (ex: featured, popular)
    • product_options
  5. Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Alphabetize Schema Fields

The GraphQL fields should be alphabetized so that it's easier to find a specific field.
Currently fields are not sorted so it's harder to find one on the list.

Expected result

  1. Schema fields are sorted, in the Docs panel and autocomplete list.
  2. Alphabetization should be verified by api-functional automated test.

Fix urlResolver query to support relative path

Scenario A

Steps to replicate

  1. Using the urlResolver query, send a valid URL for the url field, and include a leading /
  2. Note null as the response for urlResolver

Expected Behavior

The query returns the same result for the route that it would if the leading / was not present

Current Behavior

null is returned in the response payload for urlResolver

Justification

The urlResolver query is an API with the sole purpose of assisting the browser. In the browser, any way that we obtain a pathname (location.pathname, aTag.pathname, etc) will always have a leading /

Scenario B

Preconditions

  1. 2.3-develop

Steps to reproduce

  1. Send the following query to /graphql:
    {
      urlResolver(url: "/") {
    	canonical_url
        id
        type
      }
    }
    
  2. Note the following response body:
    {
      "data": {
        "urlResolver": null
      }
    }

Expected result

  1. Response body should include the same information that you'd get when querying url: "home", which is a page of type CMS_PAGE.

Actual result

Received Payload:

{
  "data": {
    "urlResolver": null
  }
}

Duplicate issue:

magento/magento2#15112

[Query] My Account > Reward Points

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
Reward Points

image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Query] My Account > Billing Agreements

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
Billing Agreements

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Query] My Account > Store Credit

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
Store Credit

image

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

GraphQL Extensibility

As a Magento developer, I want a convenient way to extend GraphQL and implement my own GraphQL endpoints so that I'm not constrained by the out-of-the-box implementation of GraphQL.

Use Cases
3rd party developer can:

  • expose simple entities via schema declarations only, without writing PHP code
  • for complex entities, you can do this with few resolver changes
  • extend GraphQL module
  • implement GraphQL endpoints
  • create or modify classes to alter schema reading/generation
  • extend the testing framework

CMS Coverage

As a developer, I want to use GraphQL to interact with CMS, Pagebuilder, and WYSIWYG content so that I can build basic frontend content experiences for my customers.

High level use cases:

  • User can view/create/update/delete CMS page entities
  • User can view/create/update/delete CMS block entities
  • User can view/create/update/delete Pagebuilder content in other entities like Product

[Mutations] My Account: Change Password

As a Magento developer, I need to build a functional My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using only GraphQL.

GraphQL needs to provide sufficient mutations (ways to create/update/delete data) for a developer to build out the storefront My Account experience for a shopper.

Use cases:

  • A logged-in shopper can change their password from the My Account Page

Acceptance criteria:

  • GraphQL provides a mutation through which the current logged-in shopper can change their password
  • Password change should work for both auth mechanisms: customer token and the session cookie
  • A guest shopper cannot change the password for any user
  • A meaningful error message is given if current password is incorrect or if new password does not conform to minimum requirements
  • Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

My Account area impacted: Account Information tab
image

Hide product attributes not intended for storefront

In Admin, if all of the following product attribute storefront properties are set to No, then it should be filtered out (not exposed by GraphQL):

  • Comparable on Storefront
  • Use in Layered Navigation
  • Use in Search Results Layered Navigation
  • Visible on Catalog Pages on Storefront
  • Used in Product Listing
  • Used for Sorting in Product Listing

Otherwise (if any of the above are Yes), attribute values and attribute metadata should be accessible in GraphQL

Changes should be covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

[Query] My Account > Newsletter Subscriptions

As a Magento developer, I need to render the My Account experience for customers via GraphQL so that I can build basic ecommerce experiences for shoppers on the front-end using GraphQL.

GraphQL needs to provide sufficient information for a developer to build out the storefront My Account experience for a shopper.

This includes being able to fetch, for the logged in customer:
Newsletter Subscriptions

Changes are covered with web API functional tests. See \Magento\GraphQl\Catalog\ProductViewTest::testQueryAllFieldsSimpleProduct as an example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.