github.com/jepp2078/gqlgen@v0.7.2/example/todo/schema.graphql (about) 1 schema { 2 query: MyQuery 3 mutation: MyMutation 4 } 5 6 type MyQuery { 7 todo(id: Int!): Todo 8 lastTodo: Todo 9 todos: [Todo!]! 10 } 11 12 type MyMutation { 13 createTodo(todo: TodoInput!): Todo! 14 updateTodo(id: Int!, changes: Map!): Todo 15 } 16 17 type Todo { 18 id: Int! 19 text: String! 20 done: Boolean! @hasRole(role: OWNER) # only the owner can see if a todo is done 21 } 22 23 "Passed to createTodo to create a new todo" 24 input TodoInput { 25 "The body text" 26 text: String! 27 "Is it done already?" 28 done: Boolean 29 } 30 31 scalar Map 32 33 "Prevents access to a field if the user doesnt have the matching role" 34 directive @hasRole(role: Role!) on FIELD_DEFINITION 35 36 enum Role { 37 ADMIN 38 OWNER 39 }