Skip to content

Instantly share code, notes, and snippets.

@helfer
Last active April 30, 2016 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helfer/52e9629623c63addd05e4f355e6072ac to your computer and use it in GitHub Desktop.
Save helfer/52e9629623c63addd05e4f355e6072ac to your computer and use it in GitHub Desktop.
// Sample GraphQL schema with decorators
+connector(storage: "MySQL")
+doc(description: "A Person")
type Person {
+mock(type: "ID")
id: Int
+mock(raw: "John")
name: String
+requireAuthRole(role: "admin")
age: Int
}
+log(info: "query")
type Query {
findPerson(name: String!): Person
+requireAuthRole(role: "admin")
allPeople(): [Person]
}
+log(info: "mutation")
+requireAuthRole(role: "admin")
type Mutation {
addPerson(
+validateLength(min: 1, max:100)
name: String!
): Person
removePerson(id: Int!): Boolean
}
schema {
query: Query
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment