2
votes

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
I can't speak to the AppSync side of things, but in GraphQL the ID scalar is always parsed into a String and serialized as a string because that's the behavior specified in the spec. You should be able to use an Int scalar instead without losing any functionality. - Daniel Rearden

1 Answers

1
votes

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.