Skip to content

Instantly share code, notes, and snippets.

@morus12
Last active September 22, 2021 18:58
Show Gist options
  • Save morus12/15bdaec26be5b9a7cbbcbd8fe2879152 to your computer and use it in GitHub Desktop.
Save morus12/15bdaec26be5b9a7cbbcbd8fe2879152 to your computer and use it in GitHub Desktop.
schema.graphql
directive @auth(
requires: String,
) on FIELD_DEFINITION
type Query {
getPerson(id: ID!): Person! @auth(requires: "policy-id")
allPersons(last: Int): [Person!]!
allPosts(last: Int): [Post!]!
search(text: String): [SearchResult]
searchID(text: String): [PlainID]
}
type Mutation {
createPerson(name: String!, age: Int!): Person! @auth(requires: "mutation-policy-id")
updatePerson(id: ID!, name: String!, age: String!): Person!
deletePerson(id: ID!): Person!
}
type Subscription {
newPerson: Person!
}
type Person {
id: ID!
name: String!
age: Int!
posts: [Post!]!
sex: Sex
}
type Post {
id: ID!
title: String!
author: Person!
}
union SearchResult = Person | Post
enum Sex {
MALE
FEMALE
OTHER
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment