-
Notifications
You must be signed in to change notification settings - Fork 645
/
schema.sdl
444 lines (326 loc) · 9.56 KB
/
schema.sdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
"""Dummy directive that can be placed on operations."""
directive @operationDirective(
"""blah"""
dummy: String!
) on QUERY | MUTATION | SUBSCRIPTION
"""For testing fragment type coercion"""
interface Bar {
bar: String!
}
type BarObject implements Bar {
bar: String!
}
"""A character from the Star Wars universe"""
interface Character {
"""The dates of appearances"""
appearanceDates: [Date!]!
"""The movies this character appears in"""
appearsIn: [Episode]!
"""The date character was born."""
birthDate: Date!
"""Test deprecated field"""
deprecated: String! @deprecated(reason: "For test purpose only")
"""Test deprecated field"""
deprecatedBool: Boolean! @deprecated(reason: "For test purpose only")
"""The date character was born."""
fieldWithUnsupportedType: UnsupportedType!
"""The movie this character first appears in"""
firstAppearsIn: Episode!
"""The friends of the character, or an empty list if they have none"""
friends: [Character]
"""The friends of the character exposed as a connection with edges"""
friendsConnection(first: Int, after: ID): FriendsConnection!
"""The ID of the character"""
id: ID!
"""Links"""
links: [URL!]!
"""The name of the character"""
name: String!
"""Profile link"""
profileLink: URL!
"""Hero type"""
type: hero_type!
}
"""The input object sent when passing in a color"""
input colorInput {
"""
A description with a dollar sign: $10
"""
red: Int! = 1
"""Green color"""
green: Float = 0
"""Blue color"""
blue: Float! = 1.5
"""for test purpose only"""
enumWithDefaultValue: Episode = new
"""Circle ref to review input"""
reviewRefInput: ReviewRefInput
}
"""The `Date` scalar type represents date format."""
scalar Date
"""An autonomous mechanical character in the Star Wars universe"""
type Droid implements Character {
"""The dates of appearances"""
appearanceDates: [Date!]!
"""The movies this droid appears in"""
appearsIn: [Episode]!
"""The date droid was created."""
birthDate: Date!
"""Test deprecated field"""
deprecated: String! @deprecated(reason: "For test purpose only")
"""Test deprecated field"""
deprecatedBool: Boolean! @deprecated(reason: "For test purpose only")
"""The date character was born."""
fieldWithUnsupportedType: UnsupportedType!
"""The movie this character first appears in"""
firstAppearsIn: Episode!
"""This droid's friends, or an empty list if they have none"""
friends: [Character]
"""The friends of the droid exposed as a connection with edges"""
friendsConnection(first: Int, after: ID): FriendsConnection!
"""The ID of the droid"""
id: ID!
"""Links"""
links: [URL!]!
"""What others call this droid"""
name: String!
"""This droid's primary function"""
primaryFunction: String
"""Profile link"""
profileLink: URL!
"""Hero type"""
type: hero_type!
}
"""The episodes in the Star Wars trilogy"""
enum Episode {
"""Star Wars Episode IV: A New Hope, released in 1977."""
NEWHOPE
"""Star Wars Episode V: The Empire Strikes Back, released in 1980."""
EMPIRE
"""Star Wars Episode VI: Return of the Jedi, released in 1983."""
JEDI
"""Test deprecated enum value"""
DEPRECATED @deprecated(reason: "For test purpose only")
"""Test java reserved word"""
new @deprecated(reason: "For test purpose only")
}
"""For testing fragment type coercion"""
interface Foo {
foo: String!
}
"""For testing fragment type coercion"""
type FooBar implements Foo & Bar {
bar: String!
foo: String!
}
"""For testing fragment type coercion"""
type FooObject implements Foo {
foo: String!
}
"""A connection object for a character's friends"""
type FriendsConnection {
"""The edges for each of the character's friends."""
edges: [FriendsEdge]
"""A list of the friends, as a convenience when edges are not needed."""
friends: [Character]
"""For test java beans semantic naming only"""
isEmpty: Boolean!
"""Information for paginating this connection"""
pageInfo: PageInfo!
"""The total number of friends"""
totalCount: Int
}
"""An edge object for a character's friends"""
type FriendsEdge {
"""A cursor used for pagination"""
cursor: ID!
"""The character represented by this friendship edge"""
node: Character
}
"""Lower case enum type name"""
enum hero_type {
human
droid
}
"""A humanoid creature from the Star Wars universe"""
type Human implements Character {
"""The dates of appearances"""
appearanceDates: [Date!]!
"""The movies this human appears in"""
appearsIn: [Episode]!
"""The date character was born."""
birthDate: Date!
"""Test deprecated field"""
deprecated: String! @deprecated(reason: "For test purpose only")
"""Test deprecated field"""
deprecatedBool: Boolean! @deprecated(reason: "For test purpose only")
"""The date character was born."""
fieldWithUnsupportedType: UnsupportedType!
"""The movie this character first appears in"""
firstAppearsIn: Episode!
"""This human's friends, or an empty list if they have none"""
friends: [Character]
"""The friends of the human exposed as a connection with edges"""
friendsConnection(first: Int, after: ID): FriendsConnection!
"""Height in the preferred unit, default is meters"""
height(unit: LengthUnit = METER): Float
"""The home planet of the human, or null if unknown"""
homePlanet: String
"""The ID of the human"""
id: ID!
"""Links"""
links: [URL!]!
"""Mass in kilograms, or null if unknown"""
mass: Float
"""What this human calls themselves"""
name: String!
"""Profile link"""
profileLink: URL!
"""A list of starships this person has piloted, or an empty list if none"""
starships: [Starship]
"""Hero type"""
type: hero_type!
}
"""Units of height"""
enum LengthUnit {
"""The standard unit around the world"""
METER
"""Primarily used in the United States"""
FOOT
}
"""The mutation type, represents all updates we can make to our data"""
type Mutation {
createReview(episode: Episode, review: ReviewInput!): Review
}
"""Information for paginating this connection"""
type PageInfo {
endCursor: ID
hasNextPage: Boolean!
startCursor: ID
}
"""
The query type, represents all of the entry points into our object graph
"""
type Query {
character(id: ID!): Character
droid(id: ID!): Droid
testNullableArguments(
int: Int,
float: Float,
string: String,
episode: Episode,
review: ReviewInput,
boolean: Boolean,
list: [Episode]): Int!
"""For testing fragment type coercion"""
foo: Foo
hero(
episode: Episode
"""for test purpose only"""
listOfListOfStringArgs: [[String]]
): Character
heroDetailQuery: Character
heroWithReview(
episode: Episode
review: ReviewInput
"""for test purpose only"""
listOfInts: [Int]
): Human
human(id: ID!): Human
nonOptionalHero(episode: Episode): Character!
reviews(episode: Episode!, starsInt: Int, starsFloat: Float): [Review]
search(text: String): [SearchResult]
starship(id: ID!): Starship
tree: Tree
typeWithGraphQLKeywords: TypeWithGraphQLKeywords
}
"""Represents a review for a movie"""
type Review {
"""Comment about the movie"""
commentary: String
"""for test purpose only"""
listOfListOfCustom: [[Date!]!]
"""for test purpose only"""
listOfListOfEnum: [[Episode!]!]
"""for test purpose only"""
listOfListOfObject: [[Character!]!]
"""for test purpose only"""
listOfListOfString: [[String!]!]
"""The number of stars this review gave, 1-5"""
stars: Int!
}
"""The input object sent when someone is creating a new review"""
input ReviewInput {
"""0-5 stars"""
stars: Int!
"""for test purpose only"""
nullableIntFieldWithDefaultValue: Int = 10
"""Comment about the movie, optional"""
commentary: String
"""Favorite color, optional"""
favoriteColor: colorInput!
"""for test purpose only"""
enumWithDefaultValue: Episode = JEDI
"""for test purpose only"""
nonNullableEnumWithDefaultValue: Episode! = JEDI
"""for test purpose only"""
nullableEnum: Episode
"""for test purpose only"""
listOfCustomScalar: [Date] = ["1984-06-21", "1984-11-21"]
"""for test purpose only"""
customScalar: Date = "1984-06-21"
"""for test purpose only"""
listOfEnums: [Episode] = [NEWHOPE, EMPIRE]
"""for test purpose only"""
listOfInt: [Int] = [1, 2, 3]
"""for test purpose only"""
listOfString: [String] = ["test1", "test2", "test3"]
"""for test purpose only"""
listOfStringNonOptional: [String]!
"""for test purpose only"""
listOfInputTypes: [colorInput] = []
"""for test purpose only"""
booleanWithDefaultValue: Boolean = true
"""for test purpose only"""
booleanNonOptional: Boolean
"""for test purpose only"""
listOfListOfString: [[String!]!]
"""for test purpose only"""
listOfListOfEnum: [[Episode!]!]
"""for test purpose only"""
listOfListOfCustom: [[Date!]!]
"""for test purpose only"""
listOfListOfObject: [[colorInput!]!]
"""for test purpose only"""
CapitalizedField: String
"""for test purpose only"""
CapitalizedInt: Int
}
"""Circle ref to review input"""
input ReviewRefInput {
reviewInput: ReviewInput
}
union SearchResult = Human | Droid | Starship
type Starship {
coordinates: [[Float!]!]
"""The ID of the starship"""
id: ID!
"""Length of the starship, along the longest axis"""
length(unit: LengthUnit = METER): Float
"""The name of the starship"""
name: String!
}
"""To test recursive structures"""
type Tree {
children: [Tree!]!
name: String!
parent: Tree
}
"""UnsupportedType for testing"""
scalar UnsupportedType
"""URL for testing"""
scalar URL
type TypeWithGraphQLKeywords {
on: String
null(fragment: String): String
}