I am new to both graphql & AWS Amplify, so please forgive any ignorance :)
I have a graphql schema like this:
type Location @model @auth(rules: [{allow: owner}]){
street: String
city: String
state: String
zip: String
}
type Trip @model @auth(rules: [{allow: owner}]){
id: String!
...
location: Location
}
I'm trying to create both the location and the trip at the same time with a mutation request like this:
mutation {
createTrip(input: {
id: "someIdentifier",
location: {
street: "somewhere"
}
}) {
id
location {
street
}
}
}
But I'm getting an error like this:
{
"data": null,
"errors": [
{
"path": null,
"locations": [
{
"line": 2,
"column": 21,
"sourceName": null
}
],
"message": "Validation error of type WrongType: argument 'input' with value '...' contains a field not in 'CreateTripInput': 'location' @ 'createTrip'"
}
]
}
Checking the generated schema.graphql
file, I see that there is indeed no location
object on the input model:
input CreateTripInput {
id: String!
...
}
How can I have amplify generate the proper input schema so that I can create both the Trip and the location objects at the same time?