首页 > 解决方案 > 当我尝试运行 gradle 时,Graphql 将错误返回为“无法解析 `Array` 值,预期的数组”

问题描述

我正在使用 ApolloClient 在 Android 中尝试突变查询,这是我的.graphql文件

mutation insertAddress($city: String, $landmark: String, $postcode: Int, $state: String, $type: String, $userUuid: String) {
    __typename
    insert_addresses(objects: {city: $city, landmark: $landmark, postcode: $postcode, state: $state, type: $type, userUuid: $userUuid}) {
      returning {
          uuid
      }
   }
}

我收到错误,com.sample.app\InsertAddress.graphql (3:30) Can't parse `Array` value, expected array 请帮助我解决此错误。

标签: androidkotlingraphqlapollo-clienthasura

解决方案


你能试一下吗

    mutation insertAddress($city: String, $landmark: String, $postcode: Int, $state: String, $type: String, $userUuid: String) {
    __typename
    insert_addresses(objects: [{city: $city, landmark: $landmark, postcode: $postcode, state: $state, type: $type, userUuid: $userUuid}]) {
      returning {
          uuid
      }
   }
}

推荐阅读