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