github.com/Kartograf/gqlgen@v0.7.2/example/starwars/schema.graphql (about) 1 # The query type, represents all of the entry points into our object graph 2 type Query { 3 hero(episode: Episode = NEWHOPE): Character 4 reviews(episode: Episode!, since: Time): [Review!]! 5 search(text: String!): [SearchResult!]! 6 character(id: ID!): Character 7 droid(id: ID!): Droid 8 human(id: ID!): Human 9 starship(id: ID!): Starship 10 } 11 # The mutation type, represents all updates we can make to our data 12 type Mutation { 13 createReview(episode: Episode!, review: ReviewInput!): Review 14 } 15 # The episodes in the Star Wars trilogy 16 enum Episode { 17 # Star Wars Episode IV: A New Hope, released in 1977. 18 NEWHOPE 19 # Star Wars Episode V: The Empire Strikes Back, released in 1980. 20 EMPIRE 21 # Star Wars Episode VI: Return of the Jedi, released in 1983. 22 JEDI 23 } 24 # A character from the Star Wars universe 25 interface Character { 26 # The ID of the character 27 id: ID! 28 # The name of the character 29 name: String! 30 # The friends of the character, or an empty list if they have none 31 friends: [Character!] 32 # The friends of the character exposed as a connection with edges 33 friendsConnection(first: Int, after: ID): FriendsConnection! 34 # The movies this character appears in 35 appearsIn: [Episode!]! 36 } 37 # Units of height 38 enum LengthUnit { 39 # The standard unit around the world 40 METER 41 # Primarily used in the United States 42 FOOT 43 } 44 # A humanoid creature from the Star Wars universe 45 type Human implements Character { 46 # The ID of the human 47 id: ID! 48 # What this human calls themselves 49 name: String! 50 # Height in the preferred unit, default is meters 51 height(unit: LengthUnit = METER): Float! 52 # Mass in kilograms, or null if unknown 53 mass: Float 54 # This human's friends, or an empty list if they have none 55 friends: [Character!] 56 # The friends of the human exposed as a connection with edges 57 friendsConnection(first: Int, after: ID): FriendsConnection! 58 # The movies this human appears in 59 appearsIn: [Episode!]! 60 # A list of starships this person has piloted, or an empty list if none 61 starships: [Starship!] 62 } 63 # An autonomous mechanical character in the Star Wars universe 64 type Droid implements Character { 65 # The ID of the droid 66 id: ID! 67 # What others call this droid 68 name: String! 69 # This droid's friends, or an empty list if they have none 70 friends: [Character!] 71 # The friends of the droid exposed as a connection with edges 72 friendsConnection(first: Int, after: ID): FriendsConnection! 73 # The movies this droid appears in 74 appearsIn: [Episode!]! 75 # This droid's primary function 76 primaryFunction: String 77 } 78 # A connection object for a character's friends 79 type FriendsConnection { 80 # The total number of friends 81 totalCount: Int! 82 # The edges for each of the character's friends. 83 edges: [FriendsEdge!] 84 # A list of the friends, as a convenience when edges are not needed. 85 friends: [Character!] 86 # Information for paginating this connection 87 pageInfo: PageInfo! 88 } 89 # An edge object for a character's friends 90 type FriendsEdge { 91 # A cursor used for pagination 92 cursor: ID! 93 # The character represented by this friendship edge 94 node: Character 95 } 96 # Information for paginating this connection 97 type PageInfo { 98 startCursor: ID! 99 endCursor: ID! 100 hasNextPage: Boolean! 101 } 102 # Represents a review for a movie 103 type Review { 104 # The number of stars this review gave, 1-5 105 stars: Int! 106 # Comment about the movie 107 commentary: String 108 # when the review was posted 109 time: Time 110 } 111 # The input object sent when someone is creating a new review 112 input ReviewInput { 113 # 0-5 stars 114 stars: Int! 115 # Comment about the movie, optional 116 commentary: String 117 # when the review was posted 118 time: Time 119 } 120 type Starship { 121 # The ID of the starship 122 id: ID! 123 # The name of the starship 124 name: String! 125 # Length of the starship, along the longest axis 126 length(unit: LengthUnit = METER): Float! 127 # coordinates tracking this ship 128 history: [[Int!]!]! 129 } 130 union SearchResult = Human | Droid | Starship 131 scalar Time