如果在突变查询中添加列表类型,则 graphql 不会在 android 中编译
graphql is not compiling in android if a list type is added in mutation query
我正在尝试使用具有列表和其他数据的输入来构建突变查询,但在编译时出现错误。
这里 ItemData 是一个 list 类型,如果我 remove 它代码正在编译正确。
查询正在 AWS 内部验证
Screenchot of Query in AWS
我的schema.graphql如下所示
mutation AddAdHoc($doc_no: String!, $bag: Int!, $cartons: Int!, $destination: String!, $pallets: Int!, $reason: String! ,$source: String!, $type: String!, $version: String, $itemData: ItemData){
addAdHocDetails(input: {doc_no: $doc_no, bag: $bag, cartons: $cartons, destination: $destination, pallets: $pallets, reason: $reason ,source: $source, type: $type, version: $version, itemData: $itemData})
{
id
}
}
我的部分 schema.json 如下所示
{
"name": "addAdHocDetails",
"description": null,
"args": [
{
"name": "input",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "addAdHocInput",
"ofType": null
}
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "TBLAdHoc",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
{
"kind": "INPUT_OBJECT",
"name": "addAdHocInput",
"description": null,
"fields": null,
"inputFields": [
{
"name": "doc_no",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "bag",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "cartons",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "destination",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "pallets",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "reason",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "source",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "type",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "version",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "itemData",
"description": null,
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "ItemData",
"ofType": null
}
},
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "ItemData",
"description": null,
"fields": null,
"inputFields": [
{
"name": "item_id",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "uom",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "qty",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "collectd",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
}
非常感谢您的帮助,
提前致谢
我成功了
ItemData的种类是List
所以我们需要把数据放在[]
这样它可以列为列表输入
mutation AddAdHoc($doc_no: String!, $bag: Int!, $cartons: Int!, $destination: String!, $pallets: Int!, $reason: String! ,$source: String!, $type: String!, $version: String, $itemData: [ItemData]){
addAdHocDetails(input: {doc_no: $doc_no, bag: $bag, cartons: $cartons, destination: $destination, pallets: $pallets, reason: $reason ,source: $source, type: $type, version: $version, itemData: $itemData})
{
id
}
}
我正在尝试使用具有列表和其他数据的输入来构建突变查询,但在编译时出现错误。
这里 ItemData 是一个 list 类型,如果我 remove 它代码正在编译正确。
查询正在 AWS 内部验证 Screenchot of Query in AWS
我的schema.graphql如下所示
mutation AddAdHoc($doc_no: String!, $bag: Int!, $cartons: Int!, $destination: String!, $pallets: Int!, $reason: String! ,$source: String!, $type: String!, $version: String, $itemData: ItemData){
addAdHocDetails(input: {doc_no: $doc_no, bag: $bag, cartons: $cartons, destination: $destination, pallets: $pallets, reason: $reason ,source: $source, type: $type, version: $version, itemData: $itemData})
{
id
}
}
我的部分 schema.json 如下所示
{
"name": "addAdHocDetails",
"description": null,
"args": [
{
"name": "input",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "addAdHocInput",
"ofType": null
}
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "TBLAdHoc",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
{
"kind": "INPUT_OBJECT",
"name": "addAdHocInput",
"description": null,
"fields": null,
"inputFields": [
{
"name": "doc_no",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "bag",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "cartons",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "destination",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "pallets",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "reason",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "source",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "type",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "version",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "itemData",
"description": null,
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "ItemData",
"ofType": null
}
},
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "ItemData",
"description": null,
"fields": null,
"inputFields": [
{
"name": "item_id",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "uom",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "qty",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "collectd",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"defaultValue": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
}
非常感谢您的帮助,
提前致谢
我成功了
ItemData的种类是List
所以我们需要把数据放在[]
这样它可以列为列表输入
mutation AddAdHoc($doc_no: String!, $bag: Int!, $cartons: Int!, $destination: String!, $pallets: Int!, $reason: String! ,$source: String!, $type: String!, $version: String, $itemData: [ItemData]){
addAdHocDetails(input: {doc_no: $doc_no, bag: $bag, cartons: $cartons, destination: $destination, pallets: $pallets, reason: $reason ,source: $source, type: $type, version: $version, itemData: $itemData})
{
id
}
}