-
-
Save koistya/04d535a1b8be4f5d5dc9 to your computer and use it in GitHub Desktop.
Sample GraphQL Schema and queries (WIP)
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
Base Schema | |
type User { | |
id: String! | |
name: String | |
handle: String | |
posts: [Post] | |
} | |
interface Topic { | |
id: String! | |
title: String | |
} | |
type Post : Topic { | |
id: String! | |
title: String | |
text: String | |
author: User | |
comments: [Comment] | |
} | |
type Comment : Topic { | |
id: String! | |
title: String | |
text: String | |
author: User | |
} | |
type QueryRoot { | |
me: User | |
user(userId: String!): User | |
post(postId: String!): Post | |
users: [User] | |
posts: [Post] | |
activity(userId: String!): [Topic] | |
} | |
Sample Queries: | |
{ | |
posts() { | |
id, | |
author { | |
name | |
}, | |
text | |
} | |
} | |
{ | |
user(id:1) { | |
...postText | |
...postTitles | |
} | |
} | |
fragment postText on User { | |
posts { | |
name | |
} | |
} | |
fragment postTitles on User { | |
posts { | |
title | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment