I was learning to use AWS amplify with React, and the API it uses is a GraphQL API that leverages AWS AppSync. I'm very new to graphQL and my schema currently is like this. This is the schema inside the amplify app:
type Note @model {
id: ID!
name: String!
description: String
title: String
image: String
}
To give you an example, I want to store an array of objects inside components in the Note type like this:
Code-1
type Note @model {
id: ID!
name: String!
description: String
title: String
image: String
components: []
}
But reading the docs I got to know there aren't any array scalar types. I know that I can create another table and do it like this instead:
Code-2
type Note @model {
id: ID!
name: String!
description: String
title: String
image: String
components: [elements!]!
}
type elements @model {
id: ID!
item: String!
}
But I don't want this as it creates a new table. I just want one table containing id, name, description, title, image and a components array where you can store objects in like shown above in Code-1. Is there any possible way to do this? Also whats the role of "@modal" in the schema?