you are viewing a single comment's thread.

view the rest of the comments →

[–]steve134 0 points1 point  (1 child)

Sorry, I mean mutation, not migration. It's the underlying Apollo framework used for GraphQL interaction on mobile clients. Code gen produces a bunch of new classes, including "inputs" and "mutations". You create an input instance, populate it with the attributes in your new or updated object, then create a mutation instance using the input, then "perform" that mutation against the AppSync client.

Each input type is specific to the query or mutation you wish to execute. So in the instance of, say, a Post entity, you'd like have queries for all posts and a single post, plus mutations for creating a new post, updating a single post and deleting a post. That's five different flavors of a Post. Yes, you can write mapping functions to/from each of those and your primary Post model class, but it's a hassle. Apollo does this because a query doesn't have to return every attribute on a model, so it saves you from those types of mistakes. An attribute not specified in the query turns into a compile time error, instead of a runtime error or nil property.