There will be times that a lot of types or inputs have some fields in common. In GraphQXL you
can inherit fields between types and inputs using spread operators.
It is very common that you do not want to expose the Common type in the public API,
so you can make it private by prefixing the name with a _ character (or the
prefix that you provide in the CLI argument):
A common pattern is to declare a GraphQL interface and to implement it in a type, but
you need to rewrite all the fields in the type that belong to the interface as they
are not implicit. You can use the spread operator also with interfaces:
interface Person {
parent: String!
childs: [String!]!
}
type Dad implements Person {
...Person
job_title: String!
}
type Kid implements Person {
...Person
school_name: String!
}
interface Person {
parent: String!
childs: [String!]!
}
type Dad implements Person {
parent: String!
childs: [String!]!
job_title: String!
}
type Kid implements Person {
parent: String!
childs: [String!]!
school_name: String!
}