Skip to content

Instantly share code, notes, and snippets.

@koistya
Forked from JeffRMoore/Graphql-SampleSchema-WIP
Created February 29, 2016 17:42
Show Gist options
  • Save koistya/04d535a1b8be4f5d5dc9 to your computer and use it in GitHub Desktop.
Save koistya/04d535a1b8be4f5d5dc9 to your computer and use it in GitHub Desktop.
Sample GraphQL Schema and queries (WIP)
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