Skip to content

Instantly share code, notes, and snippets.

@nicolasdao
Last active May 6, 2018 09:50
Show Gist options
  • Save nicolasdao/86188d6a6618138a106adad190e4e641 to your computer and use it in GitHub Desktop.
Save nicolasdao/86188d6a6618138a106adad190e4e641 to your computer and use it in GitHub Desktop.
# schema.graphql file
# Magic Generic Type.
type Paged<T> {
data: [T]
cursor: ID
}
type Node {
id: ID!
}
# Magic inheritance. The resulting Variant model
# will contain an "id" field.
type Variant inherits Node {
name: String!
shortDescription: String
}
# Magic inheritance. The resulting Product model
# will contain an "id" field.
type Product inherits Node {
name: String!
shortDescription: String
# Magic generic field.
variants: Paged<Variant>
}
type Query {
products(id: Int): [Product]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment