I am trying to use Amplify CLI to configure an AWS AppSync API and use it in an Android app. I use this site as the reference: https://aws-amplify.github.io/docs/android/api#appsync-apis-created-using-the-cli
My current workflow is as follows -
- I created the app and added the dependencies. I installed CLI at the root directory, ran
amplify init
andamplify add api
and followed the steps. I typed a basic schema in the backend api folder and ranamplify push
. (with - Continue? Yes; Update code? Yes; Generate GraphQL statements? Yes) - Next, I tested in the AWS AppSync console by adding more attributes, types, and resolvers.
- Once they worked, I made the same changes in the project's Amplify backend folder's schema; Pasted the required resolvers in the backend - resolvers folder; and ran
amplify push
again. (Continue? Yes; Update Code? Yes; Generate and overwrite GraphQL statements? No; //This is because I didn't want any existing resolvers and mutations to be overwritten) - Then I ran
amplify codegen
in the root folder of my app and build my app. //This is because even though the changes were seen in the backend after the push, I couldn't find the newly added types in the app unless I ran codegen. i.e The file -(MyApp\app\build\generated\source\appsync\com\amazonaws\amplify\generated\graphql\GetBooksQuery.java) was available only after codegen.
Is this the correct workflow? Especially the 4th step, because the above documentation link doesn't talk about how to see the new types (that were added to schema) in your Android app, after a schema-modification (in the project's backend folder) and a push, while using CLI.
If this isn't right, what is the right workflow to modify the schema and see the effects in the Android app?
(I am a beginner. TIA)