AWS amplify 中的模式在 graphql 中是否有数组和映射的标量类型?

Is there a scalar type for arrays and maps in graphql for schemas in AWS amplify?

我正在学习将 AWS amplify 与 React 结合使用,它使用的 API 是利用 AWS AppSync 的 GraphQL API。我是 graphQL 的新手,我的模式目前是这样的。这是放大应用程序中的架构:

type Note @model {
  id: ID!
  name: String!
  description: String
  title: String
  image: String
}

举个例子,我想在 Note 类型的组件中存储一个 objects 的数组,如下所示:

代码-1

type Note @model {
  id: ID!
  name: String!
  description: String
  title: String
  image: String
  components: []
}

但阅读文档后我了解到没有任何数组标量类型。我知道我可以创建另一个 table 并改为这样做:

Code-2

 type Note @model {
  id: ID!
  name: String!
  description: String
  title: String
  image: String
  components: [elements!]!
}
 
 type elements @model {
  id: ID!
  item: String!
}

但我不想要这个,因为它会创建一个新的 table。我只想要一个 table 包含 id、名称、描述、标题、图像和一个组件数组,您可以在其中存储 objects,如上面 Code-1 中所示.有什么办法可以做到这一点?另外,“@modal”在架构中的作用是什么?

查看了 AWS 文档,发现我可以将 AWSJSON 用于 lists/arrays,如 [1, 2, 3] 和地图,如 {"upvotes": 10},所以现在我的模式是:

type Note @model {
  id: ID!
  name: String!
  description: String
  title: String
  image: String
  components: AWSJSON
}

这里是 link 了解更多 AWS Scalar Types