如何使用自定义类型对GraphQL模型上的对象进行突变

时间:2019-04-22 00:49:46

标签: amazon-web-services graphql graphql-js aws-amplify aws-appsync

我有这个graphQL模式来定义我的Amplify API:

type Address @model @searchable {   
    id: ID!
    address: String!
    latitude: Float!
    longitude: Float!
}  
type Dog @model @searchable {
    id: ID!
    address: Address!
    name: String!
}

当我尝试用产生的突变创建一只狗

mutation CreateDog($input: CreateDogInput!) {
  CreateDogPoint(input: $input) {
    id
    address {
      id
      address
      latitude
      longitude
    }
    name
  }
}

我在AppSync上将以下对象作为参数来测试对象的创建:

{ "input" : { "address": { "address" : "WoofieLand", "latitude": 11, "longitude": 20 }, "name": "Rex" } }

但是,它表示地址字段不存在。如何运作,我不明白?

非常感谢您阅读。

0 个答案:

没有答案