AppSync Schema Scalar Type for Images

721 Views Asked by At

I am writing an iOS app which uses AppSync and DynamoDB as the BaaS. I need to pass an image (Binary) from the backend to the app via schema.graphql. However, based on this documentation:

https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html

There's no scalar type in the schema for images (binary). Should I use String instead? Would the app client (iOS) be able to parse the String correctly as an image?

1

There are 1 best solutions below

0
On BEST ANSWER

You should use Complex Objects to manage images. This follows best practices where the image metadata is accessible over GraphQL and the actual blob is stored in a system that is amenable to large binary files.

AWS AppSync supports this pattern with the S3Object GraphQL type (here's another example to follow for iOS).