I am attempting to specify a subtype in a graphql mutation Using AWS Amplify and AWS AppSync.
mutation CreatePhoneType {
createPhoneType(input: {
desc: "Mobile Phone"
}) {
id
desc
}
}
mutation CreatePhone {
createPhone(input: {
number: "+91 704-011-2342",
phonetype: { id: "f6b3c538-378a-48d1-a264-96dfef4472a4" }
}) {
id
number,
phonetype {
id
}
}
}
Here is the schema definition:
type Phone @model {
id: ID!
number: AWSPhone!
phonetype: PhoneType
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
type PhoneType @model {
id: ID!
desc: String!
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
I'm attempting to insert a new phone value. The Phone type has a subtype of PhoneType. I've created the PhoneType successfully and would like to reference the existing phone type as part of a mutation to create a Phone value. I've tried specifying the ID! but that does not work. How can you specify an existing subtype when creating a new value in a GraphQL mutation? I've checked the GraphQL docs but there is not a lot of information.