keyName / Resolver conflict #6472
Labels
api-graphql
Issues related to GraphQL resources in the API category
feature-request
Request a new feature
pending-response
Issue is pending response from the issue author
Describe the bug
In order to get DataStore to sync I had to change all of my connections from "@connection (name" to "@connection (keyName", but when compiling (amplify api gql-compile --minify) it throws an error if you do not have id as a mandatory field. So in the following connection statement, if I have "id:ID" it throws an error, but if I have "id:ID!" it does not.
Now here is where a problem arises. When creating a record we never provide an ID, we rely on the resolver to generate the ID as per the statement from the resolver below.
So what this means is that if you use a mutation and you don't provide an ID then the mutation fails.
There is a work around to this - get into the "input CreateModelInput" and remove the ! from the ID there - but this is a painful process when you have a lot of models.
Amplify CLI Version
4.41.2
To Reproduce
Defined above
Expected behavior
The gql-compile does not throw an error if the value is nullable - maybe a warning, but not an error
The text was updated successfully, but these errors were encountered: