Last active
October 11, 2017 17:15
-
-
Save slightlytyler/be08f0d018a3658781039effa589a371 to your computer and use it in GitHub Desktop.
GraphQL intersection types?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schema { | |
query: Query | |
} | |
type Query { | |
namespaces: AllNamespacesConnection | |
users: AllUsersConnection | |
} | |
interface Node { | |
id: ID! | |
} | |
interface Edge { | |
cursor: String! | |
node: Node! | |
} | |
interface Connection { | |
edges: [Edge]! | |
pageInfo: PageInfo! | |
} | |
type User implements Namespace, Node { | |
id: ID! | |
name: String! | |
} | |
type AllUsersEdge implements Edge { | |
cursor: String! | |
node: User! | |
} | |
type AllUsersConnection implements Connection { | |
edges: [AllUsersEdge]! | |
pageInfo: PageInfo! | |
} | |
interface Namespace { | |
name: String! | |
} | |
# Right here is the problem. | |
# How do we allow for a namespace edge? | |
# Intersection types maybe? | |
# `node` field values would need to implement both `Node` and `Namespace` to be valid | |
# https://github.com/facebook/graphql/issues/48 | |
type AllNamespacesEdge implements Edge { | |
cursor: String! | |
node: (Node + Namespace)! | |
} | |
type AllNamespacesConnection implements Connection { | |
edges: [AllNamespacesEdge]! | |
pageInfo: PageInfo! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment