恢复以前的 AWS Appsync 架构实例

Restoring Previous instance of AWS Appsync schema

希望我能解释清楚。

所以我创建了一个带有放大和推送模式的 React 应用程序,然后继续修改和创建我需要的各种解析器,因为我发现如果我再次执行 "amplify push" 因为我更改或修改添加了一个新字段所有的解析器也将被重置 我开始直接在 Appsync 控制台中更新我的模式,这样我就不必每次想要更改某些内容时都重做解析器。现在不幸的是,我以某种方式执行了放大推送,再次删除了我所有的解析器。所以我的问题是...有没有办法将我的 shema 恢复到以前的状态并恢复所有丢失的解析器?

谢谢。

首先,您是否对解析器进行了版本控制?我不会对您的解析器进行 AppSync 版本化或保留备份,但您可能希望立即联系服务团队,看看他们是否可以恢复仅存在于 AppSync API.

中的任何解析器

其次:您是更改了默认解析器还是创建了新解析器?

如果您想覆盖默认解析器,可以在 /<project_root>/amplify/backend/api/<your_api_name>/resolvers 中创建它们。 (如果不存在则创建此目录。)

以下是关于覆盖解析器的官方 Amplify 文档。在链接页面之后有一个页面

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

还有关于创建自定义解析器并将其作为自定义资源附加的文档。 https://aws-amplify.github.io/docs/cli-toolchain/graphql#overwriting-resolvers