Last active
September 4, 2019 12:58
-
-
Save alloy/8bfb39c476092e9847790c1d22efe5ea to your computer and use it in GitHub Desktop.
This file contains 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
# This is just the base schema shared by the two options below. | |
type User { | |
name: String | |
friendships: FriendshipConnection | |
} | |
type Friendship { | |
establishedAt: String | |
withUser: User | |
} | |
type Query { | |
me: User | |
} |
This file contains 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
# include 0-base-schema.graphql | |
type FriendshipConnection { | |
edges: [FriendshipConnectionEdge] | |
} | |
type FriendshipConnectionEdge { | |
metadata: Friendship | |
node: User | |
cursor: String | |
} | |
# Query like: | |
query { | |
me { | |
friendships { | |
edges { | |
__typename # FriendshipConnectionEdge | |
cursor | |
metadata { | |
__typename # Friendship | |
establishedAt | |
} | |
node { | |
__typename # User | |
name | |
} | |
} | |
} | |
} | |
} |
This file contains 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
# include 0-base-schema.graphql | |
# Add edge fields, as per spec. These fields don’t make much sense | |
# when this type is used elsewhere outside of a connection. | |
extend type Friendship { | |
node: User | |
cursor: String | |
} | |
type FriendshipConnection { | |
edges: [Friendship] | |
} | |
# Query like: | |
query { | |
me { | |
friendships { | |
edges { | |
__typename # Friendship | |
cursor | |
establishedAt | |
node { | |
__typename # User | |
name | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment