在 AWS AppSync 中定义 ID 标量类型

Define ID Scalar Type in AWS AppSync

我正在将一些现有的 Go 代码迁移到 AWS AppSync 应用程序中。在大多数情况下,这是一个相当简单的过程。但是,我 运行 遇到了 ID 标量的问题。在我现有的代码库中,ID 由 Int 支持。 AppSync 将 ID 视为字符串类型。 https://docs.aws.amazon.com/appsync/latest/devguide/designing-your-schema.htmlDefining a Todo Type 下的文档指出:

The ID scalar type is a unique identifier that can be either String or Int. You can control these in your resolver mapping templates for automatic assignment, which is covered later.

但是我在文档中找不到任何地方可以指定 ID 标量是 Int 还是 String。有没有办法像文档中建议的那样更改 AppSync 映射模板中的 ID 类型?

我是 AppSync 团队的一员,所以文档中的那一行基本上是什么意思,如果您 return 来自映射模板的 int,它将在您的数据源中被视为 int,并且相同对于字符串,它将被视为字符串。