Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 906b6ca

Browse files
authored
GraphQL: backport restructuring changes from 2.3.4 and general cleanup (#5536)
* create and move files * move mutation topic and first phase of products reorg * sweep through query topics * cosmetic changes, missing attributes * fix broken links
1 parent ccb8812 commit 906b6ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1143
-1130
lines changed

_data/toc/graphql.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ pages:
1313
- label: Get customer authorization token
1414
url: /graphql/get-customer-authorization-token.html
1515

16-
- label: Queries
17-
url: /graphql/queries.html
18-
19-
- label: Mutations
20-
url: /graphql/mutations.html
21-
2216
- label: GraphQL Caching
2317
url: /graphql/caching.html
2418

@@ -47,6 +41,9 @@ pages:
4741

4842
- label: Queries
4943
children:
44+
- label: Using queries
45+
url: /graphql/queries/index.html
46+
5047
- label: cart query
5148
url: /graphql/queries/cart.html
5249

@@ -112,6 +109,9 @@ pages:
112109

113110
- label: Mutations
114111
children:
112+
- label: Using mutations
113+
url: /graphql/mutations/index.html
114+
115115
- label: addConfigurableProductsToCart mutation
116116
url: /graphql/mutations/add-configurable-products.html
117117

@@ -214,11 +214,14 @@ pages:
214214
- label: updateCustomerAddress mutation
215215
url: /graphql/mutations/update-customer-address.html
216216

217-
- label: Product data types and interfaces
217+
- label: Catalog data types and interfaces
218218
children:
219219
- label: Product interface implementations
220220
url: /graphql/product/product-interface-implementations.html
221221

222+
- label: ProductInterface attributes
223+
url: /graphql/product/product-interface.html
224+
222225
- label: CustomizableOptionInterface
223226
url: /graphql/product/customizable-option-interface.html
224227

_data/whats-new.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ entries:
12311231
date: March 26, 2019
12321232
link: https://github.com/magento/devdocs/pull/3867
12331233
- description: The "Searches and Pagination" topic has been expanded to include more
1234-
information about queries and renamed to ["Queries"](https://devdocs.magento.com/guides/v2.3/graphql/queries.html).
1234+
information about queries and renamed to ["Using queries"](https://devdocs.magento.com/guides/v2.3/graphql/queries/index.html).
12351235
versions: 2.3.1
12361236
type: Major update
12371237
date: March 26, 2019
@@ -1257,7 +1257,7 @@ entries:
12571257
type: Major update
12581258
date: March 26, 2019
12591259
link: https://github.com/magento/devdocs/pull/3851
1260-
- description: Added a topic on [GraphQL mutations](https://devdocs.magento.com/guides/v2.3/graphql/mutations.html)
1260+
- description: Added a topic on [GraphQL mutations](https://devdocs.magento.com/guides/v2.3/graphql/mutations/index.html)
12611261
versions: 2.3.1
12621262
type: New topic
12631263
date: March 26, 2019

_includes/graphql/cart-object.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Attribute | Data Type | Description
33
`applied_coupon` | [`AppliedCoupon`][AppliedCoupon] | The `AppliedCoupon` object contains the `code` text attribute, which specifies the coupon code
44
`applied_gift_cards` | [[`AppliedGiftCard`]][AppliedGiftCard] | An array of `AppliedGiftCard` objects. An `AppliedGiftCard` object contains the `code` text attribute, which specifies the gift card code. `applied_gift_cards` is a Commerce-only attribute, defined in the GiftCardAccountGraphQl module
55
`applied_store_credit` | [`AppliedStoreCredit`][AppliedStoreCredit] | Contains store credit information applied to the cart. `applied_store_credit` is a Commerce-only attribute, defined in the CustomerBalanceGraphQl module
6-
`available_payment_methods` | [AvailablePaymentMethod][AvailablePaymentMethod] | Available payment methods
7-
`billing_address` | [BillingCartAddress][BillingCartAddress] | Contains the billing address specified in the customer's cart
6+
`available_payment_methods` | [[AvailablePaymentMethod]][AvailablePaymentMethod] | Available payment methods
7+
`billing_address` | [BillingCartAddress][BillingCartAddress]! | Contains the billing address specified in the customer's cart
88
`email` | String | The customer's email address
9-
`items` | [CartItemInterface][CartItemInterface] | Contains the items in the customer's cart
9+
`items` | [[CartItemInterface]][CartItemInterface] | Contains the items in the customer's cart
1010
`prices` | [CartPrices][CartPrices] | Contains subtotals and totals
1111
`selected_payment_method` | [SelectedPaymentMethod][SelectedPaymentMethod] | Selected payment method
12-
`shipping_addresses` | [ShippingCartAddress][ShippingCartAddress] | Contains one or more shipping addresses
12+
`shipping_addresses` | [[ShippingCartAddress]][ShippingCartAddress]! | Contains one or more shipping addresses
1313

1414
[AppliedCoupon]: {{page.baseurl}}/graphql/queries/cart.html#AppliedCoupon
1515
[AppliedGiftCard]: {{page.baseurl}}/graphql/queries/cart.html#AppliedGiftCard

guides/v2.3/graphql/develop/create-graphqls-file.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The base `schema.graphqls` file, located in the `app/code/Magento/GraphQl/etc/`
2222

2323
A query definition can be one line, or it can be complex. If your module's query implements `searchCriteria`, then you must define arguments that define filters and pagination information, all of which adds complexity. However, if you expect a single result from your query, then its definition can be simple.
2424

25-
The following example shows the `products` query. The `type` is defined as a `Query`. The `products` definitions define the keywords that are used to construct a query, as shown in [Queries]({{ page.baseurl }}/graphql/queries.html). The parameter definitions will be discussed in [Specify output attributes](#specify-output-attributes).
25+
The following example shows the `products` query. The `type` is defined as a `Query`. The `products` definitions define the keywords that are used to construct a query, as shown in [Queries]({{ page.baseurl }}/graphql/queries/index.html). The parameter definitions will be discussed in [Specify output attributes](#specify-output-attributes).
2626

2727
```text
2828
type Query {

guides/v2.3/graphql/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ GraphiQL is an in-browser tool for writing, validating, and testing GraphQL quer
4747

4848
![GraphiQL browser]({{ page.baseurl }}/graphql/images/graphql-browser.png)
4949

50-
To begin using GraphiQL, set the GraphQL endpoint by entering `http://<magento2-3-server>/graphql` in the URL bar, then click **Set endpoint**. You can use the browser in the right column to determine how to set up a query. Additional examples are also available in [Queries]({{ page.baseurl }}/graphql/queries.html).
50+
To begin using GraphiQL, set the GraphQL endpoint by entering `http://<magento2-3-server>/graphql` in the URL bar, then click **Set endpoint**. You can use the browser in the right column to determine how to set up a query. Additional examples are also available in [Queries]({{ page.baseurl }}/graphql/queries/index.html).

guides/v2.3/graphql/mutations/add-configurable-products.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mutation {
2222
cart_id: "4JQaNVJokOpFxrykGVvYrjhiNv9qt31C"
2323
cart_items: [
2424
{
25-
variant_sku: "MH02"
25+
parent_sku: "MH02"
2626
data: {
2727
quantity: 2
2828
sku: "MH02-XS-Black"
@@ -59,12 +59,20 @@ mutation {
5959
"cart": {
6060
"items": [
6161
{
62-
"id": "26",
62+
"id": "5",
6363
"quantity": 2,
6464
"product": {
65-
"name": "Teton Pullover Hoodie-XS-Black",
66-
"sku": "MH02-XS-Black"
67-
}
65+
"name": "Teton Pullover Hoodie",
66+
"sku": "MH02"
67+
},
68+
"configurable_options": [
69+
{
70+
"option_label": "Color"
71+
},
72+
{
73+
"option_label": "Size"
74+
}
75+
]
6876
}
6977
]
7078
}
@@ -81,8 +89,8 @@ The `AddConfigurableProductsToCartInput` object contains the following attribute
8189

8290
Attribute | Type | Description
8391
--- | --- | ---
84-
`cart_items` | [[ConfigurableProductCartItemInput]](#configProdCartItemInput) | An array of configurable items to add to the cart
8592
`cart_id` | String | The unique ID that identifies the customer's cart
93+
`cart_items` | [[ConfigurableProductCartItemInput]](#configProdCartItemInput) | An array of configurable items to add to the cart
8694

8795
### ConfigurableProductCartItemInput object {#configProdCartItemInput}
8896

@@ -91,8 +99,9 @@ The `ConfigurableProductCartItemInput` object contains the following attributes:
9199
Attribute | Type | Description
92100
--- | --- | ---
93101
`customizable_options` | [CustomizableOptionInput](#customOptionInput) | An object that contains the ID and value of the product
94-
`data` | [CartItemInput](#cartItemInput) | An object that contains the quantity and SKU of the configurable product
95-
`variant_sku` | String | The SKU of the simple product
102+
`data` | [CartItemInput!](#cartItemInput) | An object that contains the quantity and SKU of the configurable product
103+
`parent_sku` | String | The SKU of the simple product's parent configurable product
104+
`variant_sku` | String | Deprecated. Use `CartItemInput.sku` instead. The SKU of the simple product
96105

97106
### CustomizableOptionInput object {#customOptionInput}
98107

@@ -109,8 +118,8 @@ The `CartItemInput` object contains the following attributes:
109118

110119
Attribute | Type | Description
111120
--- | --- | ---
112-
`quantity` | Float | The number of configurable items to add to the cart
113-
`sku` | String | The SKU of the configurable product
121+
`quantity` | Float! | The number of items to add to the cart
122+
`sku` | String! | The SKU of the simple product
114123

115124
## Output attributes
116125

guides/v2.3/graphql/mutations/apply-giftcard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The following example adds a gift card with the code `0330CEIVTLB4` to the cart.
1818

1919
**Request**
2020

21-
``` text
21+
```graphql
2222
mutation {
2323
applyGiftCardToCart(
2424
input: {

guides/v2.3/graphql/mutations/apply-store-credit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In the following example, the customer starts with $10 of store credit. The subt
2323

2424
**Request**
2525

26-
```text
26+
```graphql
2727
mutation {
2828
applyStoreCreditToCart(
2929
input: {

guides/v2.3/graphql/mutations/change-customer-password.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To return or modify information about a customer, Magento recommends you use cus
99

1010
## Syntax
1111

12-
`mutation: {changeCustomerPassword(currentPassword: String!newPassword: String!) {Customer}}`
12+
`mutation: {changeCustomerPassword(currentPassword: String! newPassword: String!) {Customer}}`
1313

1414
## Example usage
1515

@@ -44,7 +44,7 @@ mutation {
4444

4545
## Input attributes
4646

47-
The `changeCustomerPassword` object requires the following inputs:
47+
The `changeCustomerPassword` mutation requires the following inputs:
4848

4949
Attribute | Data Type | Description
5050
--- | --- | ---

guides/v2.3/graphql/mutations/create-empty-cart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you are creating a cart for a logged in customer, you must include the custom
1919

2020
**Request**
2121

22-
```text
22+
```graphql
2323
mutation {
2424
createEmptyCart
2525
}

0 commit comments

Comments
 (0)