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

DISCOVERY: PWA 2.0 REST queries to Magento 2.3.1 GraphQL #953

Closed
awilcoxa opened this issue Feb 25, 2019 · 4 comments
Closed

DISCOVERY: PWA 2.0 REST queries to Magento 2.3.1 GraphQL #953

awilcoxa opened this issue Feb 25, 2019 · 4 comments
Assignees
Labels
m2 > 2.3.0 Requires Magento > 2.3.0 functionality.

Comments

@awilcoxa
Copy link

awilcoxa commented Feb 25, 2019

PWA studio should take advantage of new graphql features launched in 2.3.1 and replace existing REST queries in Venia. This discovery should result in a clear definition for LOE and scope of changes necessary to move any applicable queries from REST to GraphQL.

Remaining REST API usage in repo as of cf29cd6.

See here for parameter/options.

src/actions/cart/asyncActions.js

  • ✅ POST /rest/V1/guest-carts (can be replaced by createEmptyCart mutation)
  • ✅ POST /rest/V1/guest-carts/:cartId/items (replaceable by addSimpleProductsToCart/addConfigurableProductsToCart mutations)
  • ❌ PUT /rest/V1/guest-carts/:cartId/items/:itemId (no replacement mutation exists)
  • ❌ DELETE /rest/V1/guest-carts/:cartId/items/:itemId (no replacement mutation exists)
  • ❌ GET /rest/V1/guest-carts/:cartId/payment-methods (no replacement query exists)
  • ❌ GET /rest/V1/guest-carts/:cartId/totals (no replacement query exists. a cart query does exist, but it currently doesn't contain total information.)

src/actions/checkout/asyncActions.js

  • ❌POST /rest/V1/guest-carts/:cartId/estimate-shipping-methods (no replaceable mutation exists)
  • ✅POST /rest/V1/guest-carts/:cartId/shipping-information (can be replaced by two mutations, setShippingAddressesOnCart and setShippingMethodsOnCart. there does appear to be some complexity here, it seems to expect cart items are passed with shipping addresses, I presume to support multi-address shipping)
  • ❌POST /rest/V1/guest-carts/:cartId/payment-information (no replacement mutation exists)

src/actions/directory/asyncActions.js

  • ✅GET /rest/V1/directory/countries (can be replaced by countries query)

src/actions/user/asyncActions.js

  • ✅POST /rest/V1/integration/customer/token (can be replaced by generateCustomerToken mutation)
  • ✅GET /rest/V1/customers/me (can be replaced by customer query)
  • ✅POST /rest/V1/customers (can be replaced by createCustomer)
  • ❌PUT /rest/V1/guest-carts/:cartId (no replacement mutation exists. if we wanted to migrate to GraphQL, I think you'd have to create a new cart and copy everything over from the old cart)

src/components/CreateAccount/validators.js

  • ❌POST /rest/V1/customers/isEmailAvailable (no replacement mutation exists)

src/actions/purchaseDetails/restApi.js

  • ❌ MOCK orderDetailsRequest (customerOrders does exist, but the response structure is very light on detail, only contains total and status; no item detail either)
@awilcoxa awilcoxa added the m2 > 2.3.0 Requires Magento > 2.3.0 functionality. label Feb 27, 2019
@sirugh sirugh self-assigned this Mar 4, 2019
@cherdman cherdman added this to the Magento 2.3.1 Release milestone Mar 4, 2019
@sirugh
Copy link
Contributor

sirugh commented Mar 5, 2019

It's been a little difficult to assess the possible graphql queries provided in 2.3.1 really because of a lack of docs/notes thus far. I'm currently talking to a few people from the team responsible for that work but in the meantime I was given a draft of the release notes so far. I then tried to extract any relevant tickets from the notes and put them in this issue above.

@tjwiebell
Copy link
Contributor

@sirugh - Reviewed your findings and updated the description after confirming your suspicions about what could be replaced. I'll schedule some time with @awilcoxa to review, and break out into stories if this is deemed a priority.

@tjwiebell
Copy link
Contributor

Some GraphQL features were postponed until 2.3.2, so this full assessment will apply to 2.3.2 instead. Three replacements can still be done against 2.3.1:

  • mutation createEmptyCart
  • query countries
  • query customer

@tjwiebell
Copy link
Contributor

Created #1013 epic to track this work.

@sirugh sirugh removed their assignment Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
m2 > 2.3.0 Requires Magento > 2.3.0 functionality.
Projects
None yet
Development

No branches or pull requests

4 participants