aws amplify – Graphql – How to include schema from other types

Let us say I have the following type:

type Foo {
  id: ID!
  field1: String
}

Now, I wish to define another type, which includes the earlier type. Something like this:

type Bar {
  ...Foo,
  field2: String
}

How do I achieve the above in graphql? I want to basically first create a type, and then include that type in the definition of other types so that I don’t have to type all the attributes multiple times.

I am using Amplify / AWS Appsync so if there’s any special directive that I could use that would also be helpful

Read more here: Source link