-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Background:
- Proposal: Implicitly include properties of implemented interfaces #533
- [Proposal] Interface implementation violate "Don't Repeat Yourself" #500
The two proposals above discuss the option on how to write GraphQL in a more DRY fashion. Some concerns raised in those topics include:
- The GraphQL language is intended for reading over writing
- We should preserve backwards compatibility at all costs.
Proposal
If instead of changing the way interfaces work and/or are implemented, what if we instead enabled type composition much like Go does it. This could then be an example:
type Humanoid {
id: String
name: String
appearsIn: [Episode]
}
type Human {
Humanoid
homePlanet: String
}
type Droid {
Humanoid
primaryFunction: String
}
Or multiple types could be combined:
type TimelineItem {
date: String!
}
type Identifiable {
id: ID!
name: string
}
type SomeTimelineEvent {
TimelineItem
Identifiable
eventName: string
}
There are some details that would need to be discussed in particular how field collisions should be handled.
I don't see any real breaking changes in this or problems with backwards compatibility and it would let the typing become more DRY - let me know what you think.
martinbonnin
Metadata
Metadata
Assignees
Labels
No labels