Skip to content

Instantly share code, notes, and snippets.

@lu911
Created December 8, 2016 07:47
Show Gist options
  • Save lu911/88666fdec3e04eef94e22d1ff84e609d to your computer and use it in GitHub Desktop.
Save lu911/88666fdec3e04eef94e22d1ff84e609d to your computer and use it in GitHub Desktop.
GraphQL
schema {
query: Query
mutation: Mutation
}
interface Character {
name: String
}
type CreateUser {
ok: Boolean
user: User
}
scalar DateTime
type Droid implements Character {
name: String
function: String
}
enum Gender {
MALE
FEMALE
}
type Human implements Character {
name: String
gender: Gender
}
type Mutation {
createUser(name: String!, gender: Gender!, age: Int!): CreateUser
updateUser(userData: UserInput): UpdateUser
}
type Query {
user(id: Int): User
users: [User]
human(name: String): Human
droid(name: String): Droid
}
type UpdateUser {
ok: Boolean
user: User
}
type User {
id: ID
name: String
age: Float
gender: Gender
createdAt: DateTime
}
input UserInput {
id: ID!
name: String
age: Int
gender: Gender
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment