I hope I can explain this well.
So I created a react app with amplify and pushed my schema and went on to modify and create the various resolvers I require upon discovering that if I performed "amplify push" again because I changed or modified added a new field all the resolvers would also be reset I started updating my schema directly in the Appsync console so I won't have to redo the resolvers each time I wanted to change something. Now unfortunately I somehow performed amplify push which has removed all of my resolvers again. So my question is... is there a way to restore my shema to it's previous state and bring back all the missing resolvers?
Thanks.
First, did you version control your resolvers? I don't AppSync versions your resolvers or keeps backups, but you might want to contact the service team immediately to see if they can restore any resolvers that only existed in the AppSync API.
Second: did you change the default resolvers, or create new ones?
If you want to override the default resolvers, you can create them in /<project_root>/amplify/backend/api/<your_api_name>/resolvers
. (Create this directory if it doesn't exist.)
The below are the official Amplify documentation on overriding resolvers. There is a page directly after the linked one
Let’s say you have a simple schema.graphql…
type Todo @model {
id: ID!
name: String!
description: String
}
and you want to change the behavior of request mapping template for the Query.getTodo resolver that will be generated when the project compiles. To do this you would create a file named Query.getTodo.req.vtl in the resolvers directory of your API project. The next time you run amplify push or amplify api gql-compile, your resolver template will be used instead of the auto-generated template. You may similarly create a Query.getTodo.res.vtl file to change the behavior of the resolver’s response mapping template.
https://aws-amplify.github.io/docs/cli-toolchain/graphql#overwriting-resolvers
There is also documentation on creating custom resolvers and attaching them as a custom resource. https://aws-amplify.github.io/docs/cli-toolchain/graphql#overwriting-resolvers