Define ID Scalar Type in AWS AppSync

Viewed 547

I am migrating some existing Go code into the AWS AppSync application. For the most part this has been a fairly easy process. However, I am running into issues with the ID scalar. In my existing code base, ID is backed by an Int. AppSync is treating ID as a String type. The documentation here https://docs.aws.amazon.com/appsync/latest/devguide/designing-your-schema.html under the Defining a Todo Type states:

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.

However I cannot find anywhere in the documentation where you can specify if the ID scalar is an Int or a String. Is there a way to change the ID type in the mapping templates in AppSync like the documentation suggests?

1 Answers

I am on the AppSync team so basically what that particular line in the documentation means that if you return an int from the mapping template, it will be treated as an int in your data source and the same for a String, it will be treated as a String.

Related