@@ -27,6 +27,7 @@ type Dog implements Pet {
27
27
barkVolume: Int
28
28
doesKnowCommand(dogCommand: DogCommand!) : Boolean!
29
29
isHousetrained(atOtherHomes: Boolean): Boolean!
30
+ owner: Human
30
31
}
31
32
32
33
interface Sentient {
@@ -46,15 +47,22 @@ type Human implements Sentient {
46
47
name: String!
47
48
}
48
49
50
+ enum CatCommand { JUMP }
51
+
49
52
type Cat implements Pet {
50
53
name: String!
51
54
nickname: String
55
+ doesKnowCommand(catCommand: CatCommand!) : Boolean!
52
56
meowVolume: Int
53
57
}
54
58
55
59
union CatOrDog = Cat | Dog
56
60
union DogOrHuman = Dog | Human
57
61
union HumanOrAlien = Human | Alien
62
+
63
+ type QueryRoot {
64
+ dog: Dog
65
+ }
58
66
```
59
67
60
68
## Operations
@@ -378,10 +386,10 @@ Conversely the leaf field selections of GraphQL queries
378
386
must be scalars. Leaf selections on objects, interfaces,
379
387
and unions without subfields are disallowed.
380
388
381
- Let's assume the following query root type of the schema:
389
+ Let's assume the following additions to the query root type of the schema:
382
390
383
391
```
384
- type QueryRoot {
392
+ extend type QueryRoot {
385
393
human: Human
386
394
pet: Pet
387
395
catOrDog: CatOrDog
@@ -456,11 +464,16 @@ to our type system:
456
464
457
465
```
458
466
type Arguments {
459
- multipleReqs(x: Int!, y: Int!)
460
- booleanArgField(booleanArg: Boolean)
461
- floatArgField(floatArg: Float)
462
- intArgField(intArg: Int)
463
- nonNullBooleanArgField(nonNullBooleanArg: Boolean!)
467
+ multipleReqs(x: Int!, y: Int!): Int!
468
+ booleanArgField(booleanArg: Boolean): Boolean
469
+ floatArgField(floatArg: Float): Float
470
+ intArgField(intArg: Int): Int
471
+ nonNullBooleanArgField(nonNullBooleanArg: Boolean!): Boolean!
472
+ booleanListArgField(booleanListArg: [Boolean]!): [Boolean]
473
+ }
474
+
475
+ extend type QueryRoot {
476
+ arguments: Arguments
464
477
}
465
478
```
466
479
@@ -601,8 +614,10 @@ For example the following document is valid:
601
614
602
615
``` graphql
603
616
{
604
- ... fragmentOne
605
- ... fragmentTwo
617
+ dog {
618
+ ... fragmentOne
619
+ ... fragmentTwo
620
+ }
606
621
}
607
622
608
623
fragment fragmentOne on Dog {
@@ -620,7 +635,9 @@ While this document is invalid:
620
635
621
636
``` !graphql
622
637
{
623
- ...fragmentOne
638
+ dog {
639
+ ...fragmentOne
640
+ }
624
641
}
625
642
626
643
fragment fragmentOne on Dog {
@@ -661,7 +678,7 @@ fragment inlineFragment on Dog {
661
678
}
662
679
}
663
680
664
- fragment inlineFragment on Dog {
681
+ fragment inlineFragment2 on Dog {
665
682
... @include (if : true ) {
666
683
name
667
684
}
@@ -826,7 +843,7 @@ fragment barkVolumeFragment on Dog {
826
843
827
844
If the above fragments were inlined, this would result in the infinitely large:
828
845
829
- ``` ! graphql
846
+ ``` graphql
830
847
{
831
848
dog {
832
849
name
@@ -946,7 +963,7 @@ fragment catOrDogNameFragment on CatOrDog {
946
963
}
947
964
948
965
fragment unionWithObjectFragment on Dog {
949
- ... CatOrDogFragment
966
+ ... catOrDogNameFragment
950
967
}
951
968
```
952
969
@@ -1167,19 +1184,34 @@ Variables can only be scalars, enums, input objects, or lists and non-null
1167
1184
variants of those types. These are known as input types. Object, unions,
1168
1185
and interfaces cannot be used as inputs.
1169
1186
1187
+ For these examples, consider the following typesystem additions:
1188
+
1189
+ ```
1190
+ input ComplexInput { name: String, owner: String }
1191
+
1192
+ extend type QueryRoot {
1193
+ findDog(complex: ComplexInput): Dog
1194
+ booleanList(booleanListArg: [Boolean!]): Boolean
1195
+ }
1196
+ ```
1197
+
1170
1198
The following queries are valid:
1171
1199
1172
1200
``` graphql
1173
1201
query takesBoolean ($atOtherHomes : Boolean ) {
1174
- # ...
1202
+ dog {
1203
+ isHousetrained (atOtherHomes : $atOtherHomes )
1204
+ }
1175
1205
}
1176
1206
1177
1207
query takesComplexInput ($complexInput : ComplexInput ) {
1178
- # ...
1208
+ findDog (complex : $complexInput ) {
1209
+ name
1210
+ }
1179
1211
}
1180
1212
1181
1213
query TakesListOfBooleanBang ($booleans : [Boolean ! ]) {
1182
- # ...
1214
+ booleanList ( booleanListArg : $booleans )
1183
1215
}
1184
1216
```
1185
1217
0 commit comments