1、新增 template ,创建模板。如图1
2、点击保存按钮,查看网络请求。请求网址: https://xxx.myshopify.com/admin/themes/111/assets 。请求方法: POST。这是 REST 实现。如图2
请求的表单数据:
asset[key]: templates/article.dawn2.json
asset[value]: {
"sections": {
"main": {
"type": "main-article",
"blocks": {
"featured_image": {
"type": "featured_image",
"settings": {
}
},
"title": {
"type": "title",
"settings": {
}
},
"content": {
"type": "content",
"settings": {
}
},
"share": {
"type": "share",
"settings": {
}
}
},
"block_order": [
"featured_image",
"title",
"share",
"content"
],
"settings": {
}
}
},
"order": [
"main"
]
}
响应数据:
{
"asset": {
"key": "templates//article.dawn2.json",
"public_url": null,
"created_at": "2022-02-22T22:23:17-08:00",
"updated_at": "2022-02-22T22:23:17-08:00",
"content_type": "application//json",
"size": 324,
"checksum": "125d46765a7b7f96e7f3992a8bcfe22e",
"theme_id": 128094896334
}
}
3、在 GraphQL 中未实现创建模板文件的 API。决定参考 productCreate ( input ProductInput!, media [CreateMediaInput!] ) ProductCreatePayload Creates a product.。如图3
4、测试请求与响应结构,先测试响应失败的结构。如图4
请求数据:
mutation {
productCreate(
input: {title: "title"} {
... product
... userErrors
}
}
fragment product on ProductCreatePayload {
product {
status
storefrontId
tags
templateSuffix
title
totalInventory
totalVariants
tracksInventory
}
}
fragment userErrors on ProductCreatePayload {
userErrors {
field
message
}
}
响应数据:
{
"errors": [
{
"message": "Parse error on /"{/" (LCURLY) at [3, 29]",
"locations": [
{
"line": 3,
"column": 29
}
]
}
]
}
5、测试请求与响应结构,测试响应成功的结构。但是响应失败。如图5
请求数据:
mutation {
productCreate(
input: {
title: "标题 20220223 2",
}
) {
product {
... product
... userErrors
}
}
fragment product on ProductCreatePayload {
product {
title
}
}
fragment userErrors on ProductCreatePayload {
userErrors {
field
message
}
}
响应数据:
{
"errors": [
{
"message": "Unexpected end of document",
"locations": []
}
]
}
6、决定在 Shopify 后台 手动添加一件产品,查看网络请求,其是请求的 GraphQL API,参考其请求参数,复制至 Altair 的请求中。点击选择 query,然后右键复制值。如图6
7、粘贴至 Altair 的查询中。如图7
mutation CreateProduct($product: ProductInput!, $media: [CreateMediaInput!]) {
productCreate(input: $product, media: $media) {
product {
id
title
handle
descriptionHtml
resourceAlerts {
content
dismissed
dismissibleHandle
severity
title
actions {
primary
title
url
__typename
}
__typename
}
firstVariant: variants(first: 1) {
edges {
node {
id
requiresShipping
weight
weightUnit
barcode
sku
inventoryPolicy
fulfillmentService {
id
__typename
}
inventoryItem {
id
unitCost {
amount
__typename
}
countryCodeOfOrigin
provinceCodeOfOrigin
harmonizedSystemCode
tracked
__typename
}
...PricingCardVariant
__typename
}
__typename
}
__typename
}
...SEOCardProduct
...StandardProductType
...CustomProductType
__typename
}
userErrors {
field
message
__typename
}
__typename
}
}
fragment PricingCardVariant on ProductVariant {
id
price
compareAtPrice
taxable
taxCode
presentmentPrices(first: 2) {
edges {
node {
price {
amount
__typename
}
__typename
}
__typename
}
__typename
}
showUnitPrice
unitPriceMeasurement {
quantityValue
quantityUnit
referenceValue
referenceUnit
__typename
}
__typename
}
fragment SEOCardProduct on Product {
seo {
title
description
__typename
}
__typename
}
fragment StandardProductType on Product {
standardProductType {
productTaxonomyNodeId
parentProductTaxonomyNodeId
name
fullName
isLeaf
isRoot
__typename
}
inferredProductMetadata {
standardProductType {
productTaxonomyNodeId
parentProductTaxonomyNodeId
name
fullName
isLeaf
isRoot
__typename
}
__typename
}
__typename
}
fragment CustomProductType on Product {
customProductType
__typename
}
8、点击选择 variables,然后右键复制值。如图8
9、粘贴至 Altair 的变量中。如图9
{
"media": null,
"product": {
"standardProductType": null,
"customProductType": null,
"title": "标题 20220223 1",
"descriptionHtml": "",
"handle": "",
"seo": {
"title": "",
"description": ""
},
"status": "DRAFT",
"variants": [
{
"compareAtPrice": null,
"price": "0",
"taxable": true,
"inventoryItem": {
"cost": null,
"countryCodeOfOrigin": null,
"provinceCodeOfOrigin": null,
"harmonizedSystemCode": null,
"tracked": true
},
"requiresShipping": true,
"weight": 0,
"weightUnit": "KILOGRAMS",
"fulfillmentServiceId": "gid://shopify/FulfillmentService/manual",
"sku": "",
"barcode": "",
"inventoryPolicy": "DENY",
"showUnitPrice": false,
"unitPriceMeasurement": {
"quantityValue": 0,
"quantityUnit": null,
"referenceValue": 0,
"referenceUnit": null
},
"taxCode": null,
"inventoryQuantities": [
{
"availableQuantity": 0,
"locationId": "gid://shopify/Location/66268496078"
}
],
"options": [
"Default Title"
]
}
],
"images": [],
"tags": [],
"templateSuffix": "",
"giftCardTemplateSuffix": "",
"vendor": "",
"giftCard": false,
"collectionsToJoin": [],
"workflow": "product-details-create",
"metafields": []
}
}
10、发送请求报错,响应:Field ‘resourceAlerts’ doesn’t exist on type ‘Product’。在查询中依次删除:resourceAlerts、showUnitPrice、unitPriceMeasurement、standardProductType。如图10
{
"errors": [
{
"message": "Field 'resourceAlerts' doesn't exist on type 'Product'",
"locations": [
{
"line": 8,
"column": 7
}
],
"path": [
"mutation CreateProduct",
"productCreate",
"product",
"resourceAlerts"
],
"extensions": {
"code": "undefinedField",
"typeName": "Product",
"fieldName": "resourceAlerts"
}
},
{
"message": "Field 'showUnitPrice' doesn't exist on type 'ProductVariant'",
"locations": [
{
"line": 88,
"column": 3
}
],
"path": [
"fragment PricingCardVariant",
"showUnitPrice"
],
"extensions": {
"code": "undefinedField",
"typeName": "ProductVariant",
"fieldName": "showUnitPrice"
}
},
{
"message": "Field 'unitPriceMeasurement' doesn't exist on type 'ProductVariant'",
"locations": [
{
"line": 89,
"column": 3
}
],
"path": [
"fragment PricingCardVariant",
"unitPriceMeasurement"
],
"extensions": {
"code": "undefinedField",
"typeName": "ProductVariant",
"fieldName": "unitPriceMeasurement"
}
},
{
"message": "Field 'standardProductType' doesn't exist on type 'Product'",
"locations": [
{
"line": 109,
"column": 3
}
],
"path": [
"fragment StandardProductType",
"standardProductType"
],
"extensions": {
"code": "undefinedField",
"typeName": "Product",
"fieldName": "standardProductType"
}
},
{
"message": "Field 'inferredProductMetadata' doesn't exist on type 'Product'",
"locations": [
{
"line": 118,
"column": 3
}
],
"path": [
"fragment StandardProductType",
"inferredProductMetadata"
],
"extensions": {
"code": "undefinedField",
"typeName": "Product",
"fieldName": "inferredProductMetadata"
}
}
]
}
11、发送请求报错,响应:Variable $product of type ProductInput! was provided invalid value for standardProductType (Field is not defined on ProductInput), variants.0.inventoryItem.countryCodeOfOrigin (Field is not defined on InventoryItemInput), variants.0.inventoryItem.provinceCodeOfOrigin (Field is not defined on InventoryItemInput), variants.0.inventoryItem.harmonizedSystemCode (Field is not defined on InventoryItemInput), variants.0.showUnitPrice (Field is not defined on ProductVariantInput), variants.0.unitPriceMeasurement (Field is not defined on ProductVariantInput), workflow (Field is not defined on ProductInput)。在变量中依次删除:standardProductType、variants.0.inventoryItem.countryCodeOfOrigin、variants.0.inventoryItem.provinceCodeOfOrigin、variants.0.inventoryItem.harmonizedSystemCode、variants.0.showUnitPrice、variants.0.unitPriceMeasurement、workflow。如图11
{
"errors": [
{
"message": "Variable $product of type ProductInput! was provided invalid value for standardProductType (Field is not defined on ProductInput), variants.0.inventoryItem.countryCodeOfOrigin (Field is not defined on InventoryItemInput), variants.0.inventoryItem.provinceCodeOfOrigin (Field is not defined on InventoryItemInput), variants.0.inventoryItem.harmonizedSystemCode (Field is not defined on InventoryItemInput), variants.0.showUnitPrice (Field is not defined on ProductVariantInput), variants.0.unitPriceMeasurement (Field is not defined on ProductVariantInput), workflow (Field is not defined on ProductInput)",
"locations": [
{
"line": 1,
"column": 24
}
],
"extensions": {
"value": {
"standardProductType": null,
"customProductType": null,
"title": "标题 20220223 3",
"descriptionHtml": "",
"handle": "",
"seo": {
"title": "",
"description": ""
},
"status": "DRAFT",
"variants": [
{
"compareAtPrice": null,
"price": "0",
"taxable": true,
"inventoryItem": {
"cost": null,
"countryCodeOfOrigin": null,
"provinceCodeOfOrigin": null,
"harmonizedSystemCode": null,
"tracked": true
},
"requiresShipping": true,
"weight": 0,
"weightUnit": "KILOGRAMS",
"fulfillmentServiceId": "gid://shopify/FulfillmentService/manual",
"sku": "",
"barcode": "",
"inventoryPolicy": "DENY",
"showUnitPrice": false,
"unitPriceMeasurement": {
"quantityValue": 0,
"quantityUnit": null,
"referenceValue": 0,
"referenceUnit": null
},
"taxCode": null,
"inventoryQuantities": [
{
"availableQuantity": 0,
"locationId": "gid://shopify/Location/66268496078"
}
],
"options": [
"Default Title"
]
}
],
"images": [],
"tags": [],
"templateSuffix": "",
"giftCardTemplateSuffix": "",
"vendor": "",
"giftCard": false,
"collectionsToJoin": [],
"workflow": "product-details-create",
"metafields": []
},
"problems": [
{
"path": [
"standardProductType"
],
"explanation": "Field is not defined on ProductInput"
},
{
"path": [
"variants",
0,
"inventoryItem",
"countryCodeOfOrigin"
],
"explanation": "Field is not defined on InventoryItemInput"
},
{
"path": [
"variants",
0,
"inventoryItem",
"provinceCodeOfOrigin"
],
"explanation": "Field is not defined on InventoryItemInput"
},
{
"path": [
"variants",
0,
"inventoryItem",
"harmonizedSystemCode"
],
"explanation": "Field is not defined on InventoryItemInput"
},
{
"path": [
"variants",
0,
"showUnitPrice"
],
"explanation": "Field is not defined on ProductVariantInput"
},
{
"path": [
"variants",
0,
"unitPriceMeasurement"
],
"explanation": "Field is not defined on ProductVariantInput"
},
{
"path": [
"workflow"
],
"explanation": "Field is not defined on ProductInput"
}
]
}
}
]
}
12、创建产品成功。响应 200。如图12
请求查询:
mutation CreateProduct($product: ProductInput!, $media: [CreateMediaInput!]) {
productCreate(input: $product, media: $media) {
product {
id
title
handle
descriptionHtml
firstVariant: variants(first: 1) {
edges {
node {
id
requiresShipping
weight
weightUnit
barcode
sku
inventoryPolicy
fulfillmentService {
id
__typename
}
inventoryItem {
id
unitCost {
amount
__typename
}
countryCodeOfOrigin
provinceCodeOfOrigin
harmonizedSystemCode
tracked
__typename
}
...PricingCardVariant
__typename
}
__typename
}
__typename
}
...SEOCardProduct
...CustomProductType
__typename
}
userErrors {
field
message
__typename
}
__typename
}
}
fragment PricingCardVariant on ProductVariant {
id
price
compareAtPrice
taxable
taxCode
presentmentPrices(first: 2) {
edges {
node {
price {
amount
__typename
}
__typename
}
__typename
}
__typename
}
__typename
}
fragment SEOCardProduct on Product {
seo {
title
description
__typename
}
__typename
}
fragment CustomProductType on Product {
customProductType
__typename
}
请求变量:
{
"media": null,
"product": {
"customProductType": null,
"title": "标题 20220223 3",
"descriptionHtml": "",
"handle": "",
"seo": {
"title": "",
"description": ""
},
"status": "DRAFT",
"variants": [
{
"compareAtPrice": null,
"price": "0",
"taxable": true,
"inventoryItem": {
"cost": null,
"tracked": true
},
"requiresShipping": true,
"weight": 0,
"weightUnit": "KILOGRAMS",
"fulfillmentServiceId": "gid://shopify/FulfillmentService/manual",
"sku": "",
"barcode": "",
"inventoryPolicy": "DENY",
"taxCode": null,
"inventoryQuantities": [
{
"availableQuantity": 0,
"locationId": "gid://shopify/Location/66268496078"
}
],
"options": [
"Default Title"
]
}
],
"images": [],
"tags": [],
"templateSuffix": "",
"giftCardTemplateSuffix": "",
"vendor": "",
"giftCard": false,
"collectionsToJoin": [],
"metafields": []
}
}
响应:
{
"data": {
"productCreate": {
"product": {
"id": "gid://shopify/Product/6956647317710",
"title": "标题 20220223 3",
"handle": "标题-20220223-3",
"descriptionHtml": "",
"firstVariant": {
"edges": [
{
"node": {
"id": "gid://shopify/ProductVariant/40929372405966",
"requiresShipping": true,
"weight": 0,
"weightUnit": "KILOGRAMS",
"barcode": "",
"sku": "",
"inventoryPolicy": "DENY",
"fulfillmentService": {
"id": "gid://shopify/FulfillmentService/manual",
"__typename": "FulfillmentService"
},
"inventoryItem": {
"id": "gid://shopify/InventoryItem/43021592854734",
"unitCost": null,
"countryCodeOfOrigin": null,
"provinceCodeOfOrigin": null,
"harmonizedSystemCode": null,
"tracked": true,
"__typename": "InventoryItem"
},
"price": "0.00",
"compareAtPrice": null,
"taxable": true,
"taxCode": null,
"presentmentPrices": {
"edges": [
{
"node": {
"price": {
"amount": "0.0",
"__typename": "MoneyV2"
},
"__typename": "ProductVariantPricePair"
},
"__typename": "ProductVariantPricePairEdge"
}
],
"__typename": "ProductVariantPricePairConnection"
},
"__typename": "ProductVariant"
},
"__typename": "ProductVariantEdge"
}
],
"__typename": "ProductVariantConnection"
},
"seo": {
"title": null,
"description": null,
"__typename": "SEO"
},
"__typename": "Product",
"customProductType": null
},
"userErrors": [],
"__typename": "ProductCreatePayload"
}
},
"extensions": {
"cost": {
"requestedQueryCost": 20,
"actualQueryCost": 19,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 981,
"restoreRate": 50
}
}
}
}
13、为何 Shopify 后台调用 GraphQL API 的请求参数与最新版本的 GraphQL API 不相匹配,初步怀疑可能是版本不一致所导致。Shopify 后台调用 GraphQL API 的版本不是最新版本。现在最新版本为:2022-01。而后台调用的版本为:2020-07。如图13
14、当请求响应报错时的结构。如图14
mutation {
onlineStoreThemeAssetCreate(
input: { themeId: "vogue", content: "string", key: "string" }
) {
themeAsset {
id
themeId
version
content
key
mimeType
category
schema
createdAt
updatedAt
deletable
renameable
updatable
}
}
}
{
"errors": [
{
"debugMessage": "Undefined index: key",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [
{
"line": 5,
"column": 5
}
],
"path": [
"onlineStoreThemeAssetCreate",
"themeAsset"
],
"trace": [
{
"file": "E://wwwroot//wshop//platform//Modules//ThemeStore//Resolver//OnlineStoreTheme//ThemeAssetResolver.php",
"line": 15,
"call": "Illuminate//Foundation//Bootstrap//HandleExceptions::handleError(8, 'Undefined index: key', 'E://wwwroot//wshop//platform//Modules//ThemeStore//Resolver//OnlineStoreTheme//ThemeAssetResolver.php', 15, array(5))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Schema//Directives//FieldDirective.php",
"line": 52,
"call": "Modules//ThemeStore//Resolver//OnlineStoreTheme//ThemeAssetResolver::__invoke(array(1), array(1), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Schema//Directives//RenameArgsDirective.php",
"line": 33,
"call": "Nuwave//Lighthouse//Schema//Directives//FieldDirective::Nuwave//Lighthouse//Schema//Directives//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Schema//Directives//SpreadDirective.php",
"line": 36,
"call": "Nuwave//Lighthouse//Schema//Directives//RenameArgsDirective::Nuwave//Lighthouse//Schema//Directives//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Schema//Directives//ArgTraversalDirective.php",
"line": 29,
"call": "Nuwave//Lighthouse//Schema//Directives//SpreadDirective::Nuwave//Lighthouse//Schema//Directives//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Validation//ValidateDirective.php",
"line": 53,
"call": "Nuwave//Lighthouse//Schema//Directives//ArgTraversalDirective::Nuwave//Lighthouse//Schema//Directives//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Schema//Directives//ArgTraversalDirective.php",
"line": 29,
"call": "Nuwave//Lighthouse//Validation//ValidateDirective::Nuwave//Lighthouse//Validation//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Schema//Directives//TrimDirective.php",
"line": 56,
"call": "Nuwave//Lighthouse//Schema//Directives//ArgTraversalDirective::Nuwave//Lighthouse//Schema//Directives//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Schema//Factories//FieldFactory.php",
"line": 99,
"call": "Nuwave//Lighthouse//Schema//Directives//TrimDirective::Nuwave//Lighthouse//Schema//Directives//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 623,
"call": "Nuwave//Lighthouse//Schema//Factories//FieldFactory::Nuwave//Lighthouse//Schema//Factories//{closure}(array(1), array(0), instance of Nuwave//Lighthouse//Schema//Context, instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 550,
"call": "GraphQL//Executor//ReferenceExecutor::resolveFieldValueOrError(instance of GraphQL//Type//Definition//FieldDefinition, instance of GraphQL//Language//AST//FieldNode, instance of Closure, array(1), instance of GraphQL//Type//Definition//ResolveInfo)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 1195,
"call": "GraphQL//Executor//ReferenceExecutor::resolveField(GraphQLType: OnlineStoreThemeAssetCreatePayload, array(1), instance of ArrayObject(1), array(2))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 1145,
"call": "GraphQL//Executor//ReferenceExecutor::executeFields(GraphQLType: OnlineStoreThemeAssetCreatePayload, array(1), array(1), instance of ArrayObject(1))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 1106,
"call": "GraphQL//Executor//ReferenceExecutor::collectAndExecuteSubfields(GraphQLType: OnlineStoreThemeAssetCreatePayload, instance of ArrayObject(1), array(1), array(1))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 793,
"call": "GraphQL//Executor//ReferenceExecutor::completeObjectValue(GraphQLType: OnlineStoreThemeAssetCreatePayload, instance of ArrayObject(1), instance of GraphQL//Type//Definition//ResolveInfo, array(1), array(1))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 654,
"call": "GraphQL//Executor//ReferenceExecutor::completeValue(GraphQLType: OnlineStoreThemeAssetCreatePayload, instance of ArrayObject(1), instance of GraphQL//Type//Definition//ResolveInfo, array(1), array(1))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 557,
"call": "GraphQL//Executor//ReferenceExecutor::completeValueCatchingError(GraphQLType: OnlineStoreThemeAssetCreatePayload, instance of ArrayObject(1), instance of GraphQL//Type//Definition//ResolveInfo, array(1), array(1))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 474,
"call": "GraphQL//Executor//ReferenceExecutor::resolveField(GraphQLType: Mutation, null, instance of ArrayObject(1), array(1))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 857,
"call": "GraphQL//Executor//ReferenceExecutor::GraphQL//Executor//{closure}(array(0), 'onlineStoreThemeAssetCreate')"
},
{
"call": "GraphQL//Executor//ReferenceExecutor::GraphQL//Executor//{closure}(array(0), 'onlineStoreThemeAssetCreate')"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 859,
"function": "array_reduce(array(1), instance of Closure, array(0))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 490,
"call": "GraphQL//Executor//ReferenceExecutor::promiseReduce(array(1), instance of Closure, array(0))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 263,
"call": "GraphQL//Executor//ReferenceExecutor::executeFieldsSerially(GraphQLType: Mutation, null, array(0), instance of ArrayObject(1))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//ReferenceExecutor.php",
"line": 215,
"call": "GraphQL//Executor//ReferenceExecutor::executeOperation(instance of GraphQL//Language//AST//OperationDefinitionNode, null)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//Executor//Executor.php",
"line": 156,
"call": "GraphQL//Executor//ReferenceExecutor::doExecute()"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//GraphQL.php",
"line": 162,
"call": "GraphQL//Executor//Executor::promiseToExecute(instance of GraphQL//Executor//Promise//Adapter//SyncPromiseAdapter, instance of GraphQL//Type//Schema, instance of GraphQL//Language//AST//DocumentNode, null, instance of Nuwave//Lighthouse//Schema//Context, array(0), null, null)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//webonyx//graphql-php//src//GraphQL.php",
"line": 94,
"call": "GraphQL//GraphQL::promiseToExecute(instance of GraphQL//Executor//Promise//Adapter//SyncPromiseAdapter, instance of GraphQL//Type//Schema, instance of GraphQL//Language//AST//DocumentNode, null, instance of Nuwave//Lighthouse//Schema//Context, array(0), null, null, array(29))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//GraphQL.php",
"line": 268,
"call": "GraphQL//GraphQL::executeQuery(instance of GraphQL//Type//Schema, instance of GraphQL//Language//AST//DocumentNode, null, instance of Nuwave//Lighthouse//Schema//Context, array(0), null, null, array(29))"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//GraphQL.php",
"line": 203,
"call": "Nuwave//Lighthouse//GraphQL::executeParsedQuery(instance of GraphQL//Language//AST//DocumentNode, instance of Nuwave//Lighthouse//Schema//Context, array(0), null, null)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//GraphQL.php",
"line": 162,
"call": "Nuwave//Lighthouse//GraphQL::parseAndExecuteQuery('mutation {/n onlineStoreThemeAssetCreate(/n input: { themeId: /"vogue/", content: /"string/", key: /"string/" }/n ) {/n themeAsset {/n id/n themeId/n version/n content/n key/n mimeType/n category/n schema/n createdAt/n updatedAt/n deletable/n renameable/n updatable/n }/n }/n}', instance of Nuwave//Lighthouse//Schema//Context, array(0), null, null)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//GraphQL.php",
"line": 121,
"call": "Nuwave//Lighthouse//GraphQL::executeOperation(instance of GraphQL//Server//OperationParams, instance of Nuwave//Lighthouse//Schema//Context)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Support//Utils.php",
"line": 99,
"call": "Nuwave//Lighthouse//GraphQL::Nuwave//Lighthouse//{closure}(instance of GraphQL//Server//OperationParams)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//GraphQL.php",
"line": 120,
"call": "Nuwave//Lighthouse//Support//Utils::applyEach(instance of Closure, instance of GraphQL//Server//OperationParams)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Support//Http//Controllers//GraphQLController.php",
"line": 32,
"call": "Nuwave//Lighthouse//GraphQL::executeOperationOrOperations(instance of GraphQL//Server//OperationParams, instance of Nuwave//Lighthouse//Schema//Context)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//ControllerDispatcher.php",
"line": 48,
"call": "Nuwave//Lighthouse//Support//Http//Controllers//GraphQLController::__invoke(instance of Illuminate//Http//Request, instance of Nuwave//Lighthouse//GraphQL, instance of Illuminate//Events//Dispatcher, instance of Laragraph//Utils//RequestParser, instance of Nuwave//Lighthouse//Execution//SingleResponse, instance of Nuwave//Lighthouse//Execution//ContextFactory)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//Route.php",
"line": 219,
"call": "Illuminate//Routing//ControllerDispatcher::dispatch(instance of Illuminate//Routing//Route, instance of Nuwave//Lighthouse//Support//Http//Controllers//GraphQLController, '__invoke')"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//Route.php",
"line": 176,
"call": "Illuminate//Routing//Route::runController()"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//Router.php",
"line": 681,
"call": "Illuminate//Routing//Route::run()"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 130,
"call": "Illuminate//Routing//Router::Illuminate//Routing//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Support//Http//Middleware//AttemptAuthentication.php",
"line": 34,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Nuwave//Lighthouse//Support//Http//Middleware//AttemptAuthentication::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//nuwave//lighthouse//src//Support//Http//Middleware//AcceptJson.php",
"line": 27,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Nuwave//Lighthouse//Support//Http//Middleware//AcceptJson::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 105,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//Router.php",
"line": 683,
"call": "Illuminate//Pipeline//Pipeline::then(instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//Router.php",
"line": 658,
"call": "Illuminate//Routing//Router::runRouteWithinStack(instance of Illuminate//Routing//Route, instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//Router.php",
"line": 624,
"call": "Illuminate//Routing//Router::runRoute(instance of Illuminate//Http//Request, instance of Illuminate//Routing//Route)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Routing//Router.php",
"line": 613,
"call": "Illuminate//Routing//Router::dispatchToRoute(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Foundation//Http//Kernel.php",
"line": 170,
"call": "Illuminate//Routing//Router::dispatch(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 130,
"call": "Illuminate//Foundation//Http//Kernel::Illuminate//Foundation//Http//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//barryvdh//laravel-debugbar//src//Middleware//InjectDebugbar.php",
"line": 67,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Barryvdh//Debugbar//Middleware//InjectDebugbar::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//app//Http//Middleware//ChangeAppUrlMiddleware.php",
"line": 23,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "App//Http//Middleware//ChangeAppUrlMiddleware::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Foundation//Http//Middleware//TransformsRequest.php",
"line": 21,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Illuminate//Foundation//Http//Middleware//TransformsRequest::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Foundation//Http//Middleware//TransformsRequest.php",
"line": 21,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Illuminate//Foundation//Http//Middleware//TransformsRequest::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Foundation//Http//Middleware//ValidatePostSize.php",
"line": 27,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Illuminate//Foundation//Http//Middleware//ValidatePostSize::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Foundation//Http//Middleware//CheckForMaintenanceMode.php",
"line": 63,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Illuminate//Foundation//Http//Middleware//CheckForMaintenanceMode::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//fideloper//proxy//src//TrustProxies.php",
"line": 57,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Fideloper//Proxy//TrustProxies::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//dingo//api//src//Http//Middleware//Request.php",
"line": 111,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 171,
"call": "Dingo//Api//Http//Middleware//Request::handle(instance of Illuminate//Http//Request, instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Pipeline//Pipeline.php",
"line": 105,
"call": "Illuminate//Pipeline//Pipeline::Illuminate//Pipeline//{closure}(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Foundation//Http//Kernel.php",
"line": 145,
"call": "Illuminate//Pipeline//Pipeline::then(instance of Closure)"
},
{
"file": "E://wwwroot//wshop//platform//vendor//laravel//framework//src//Illuminate//Foundation//Http//Kernel.php",
"line": 110,
"call": "Illuminate//Foundation//Http//Kernel::sendRequestThroughRouter(instance of Illuminate//Http//Request)"
},
{
"file": "E://wwwroot//wshop//platform//public//index.php",
"line": 57,
"call": "Illuminate//Foundation//Http//Kernel::handle(instance of Illuminate//Http//Request)"
}
]
}
],
"data": {
"onlineStoreThemeAssetCreate": {
"themeAsset": null
}
}
}
15、当请求响应成功时的结构。如图15
mutation {
onlineStoreThemeAssetCreate(
input: { themeId: "vogue", content: "string", key: "string" }
) {
themeAsset {
id
themeId
content
key
mimeType
category
schema
createdAt
updatedAt
deletable
renameable
updatable
}
}
}
{
"data": {
"onlineStoreThemeAssetCreate": {
"themeAsset": {
"id": "653",
"themeId": "vogue",
"content": "string",
"key": "string",
"mimeType": "text/x-php",
"category": "unknown",
"schema": null,
"createdAt": "2022-02-25 01:49:53",
"updatedAt": "2022-02-25 01:49:53",
"deletable": false,
"renameable": false,
"updatable": false
}
}
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/webdev/250727.html
