图像的 AppSync 架构标量类型

AppSync Schema Scalar Type for Images

我正在编写一个 iOS 应用程序,它使用 AppSync 和 DynamoDB 作为 BaaS。我需要通过 schema.graphql 将图像(二进制)从后端传递到应用程序。但是,基于此文档:

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

图像(二进制)架构中没有标量类型。我应该改用 String 吗?应用程序客户端 (iOS) 能否将字符串正确解析为图像?

您应该使用 Complex Objects 来管理图像。这遵循最佳实践,其中图像元数据可通过 GraphQL 访问,实际 blob 存储在适合大型二进制文件的系统中。

AWS AppSync 使用 S3Object GraphQL 类型支持此模式(iOS 后跟 another example)。