I am fairly new to both GraphQL and AWS amplify so this might be a newbie question.
I have defined the type listed below in schema.graphql. If I create a mutation using a type with id: ID!, I get a Cannot return null for non-nullable field Vocabulary.id.
How do I specify a field should be an identity field in AWS amplify graphql? specifying id: ID! for an identity field, in this AWS amplify workshop seems to work fine.
~\amplify\backend\api\vidaudtranscription\schema.graphql:
type Vocabulary @model
@key(fields:["userId"])
@auth(rules: [{allow: owner}])
{
id: ID!
userId: String!
vocabularies: [String!]!
}
Mutation Request:
mutation MyMutation {
createVocabulary(input: {userId: "abc", vocabularies: ["123", "456"]}) {
id
owner
userId
vocabularies
}
}
Mutation Response:
{
"data": {
"createVocabulary": null
},
"errors": [
{
"message": "Cannot return null for non-nullable field Vocabulary.id.",
"locations": [
{
"line": 5,
"column": 5
}
],
"path": [
"createVocabulary",
"id"
]
}
]
}