Repository navigation
Expand file tree
/
Copy pathGraphQLSchemaTest.groovy
More file actions
753 lines (613 loc) · 27.1 KB
/
Copy pathGraphQLSchemaTest.groovy
File metadata and controls
753 lines (613 loc) · 27.1 KB
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
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
package graphql.schema
import graphql.AssertException
import graphql.Directives
import graphql.ExecutionInput
import graphql.introspection.Introspection.DirectiveLocation
import graphql.GraphQL
import graphql.TestUtil
import graphql.language.Directive
import graphql.language.SchemaExtensionDefinition
import graphql.schema.idl.RuntimeWiring
import graphql.schema.idl.TypeRuntimeWiring
import graphql.util.TraversalControl
import graphql.util.TraverserContext
import spock.lang.Specification
import java.util.function.UnaryOperator
import static graphql.Scalars.GraphQLString
import static graphql.StarWarsSchema.characterInterface
import static graphql.StarWarsSchema.droidType
import static graphql.StarWarsSchema.humanType
import static graphql.StarWarsSchema.starWarsSchema
import static graphql.schema.GraphQLArgument.newArgument
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition
import static graphql.schema.GraphQLInputObjectField.newInputObjectField
import static graphql.schema.GraphQLInputObjectType.newInputObject
import static graphql.schema.GraphQLNonNull.nonNull
import static graphql.schema.GraphQLObjectType.newObject
import static graphql.schema.GraphQLTypeReference.typeRef
import static java.util.stream.Collectors.toList
class GraphQLSchemaTest extends Specification {
def "getImplementations works as expected"() {
when:
List<GraphQLObjectType> objectTypes = starWarsSchema.getImplementations(characterInterface)
then:
objectTypes.size() == 2
objectTypes == [
droidType, humanType
]
}
def "isPossibleType works as expected"() {
expect:
starWarsSchema.isPossibleType(characterInterface, humanType)
}
def "isPossibleType when wrong abstract type is passed expect exception"() {
when:
starWarsSchema.isPossibleType(humanType, humanType)
then:
thrown(AssertException)
}
def "#698 interfaces copied as expected"() {
def idl = """
type Query {
foo: Node
}
interface Node {
id: String
}
type Foo implements Node {
id: String
}
"""
RuntimeWiring runtimeWiring = RuntimeWiring.newRuntimeWiring()
.type("Query", { wiring ->
wiring.dataFetcher("foo", { env ->
Map<String, Object> map = new HashMap<>()
map.put("id", "abc")
return map
})
} as UnaryOperator<TypeRuntimeWiring.Builder>)
.type("Node", { wiring ->
wiring.typeResolver({ env -> (GraphQLObjectType) env.getSchema().getType("Foo") })
} as UnaryOperator<TypeRuntimeWiring.Builder>)
.build()
def existingSchema = TestUtil.schema(idl, runtimeWiring)
GraphQLSchema schema = existingSchema.transform({})
expect:
assert 0 == runQuery(existingSchema).getErrors().size()
assert 0 == runQuery(schema).getErrors().size()
}
static def runQuery(GraphQLSchema schema) {
GraphQL graphQL = GraphQL.newGraphQL(schema)
.build()
ExecutionInput executionInput = ExecutionInput.newExecutionInput()
.query("{foo {id}}")
.build()
return graphQL
.executeAsync(executionInput)
.join()
}
static def basicSchemaBuilder() {
def queryTypeName = "QueryType"
def fooCoordinates = FieldCoordinates.coordinates(queryTypeName, "hero")
DataFetcher<?> basicDataFetcher = new DataFetcher<Object>() {
@Override
Object get(DataFetchingEnvironment environment) throws Exception {
return null
}
}
GraphQLCodeRegistry codeRegistry = GraphQLCodeRegistry.newCodeRegistry()
.dataFetcher(fooCoordinates, basicDataFetcher)
.build()
GraphQLSchema.newSchema()
.codeRegistry(codeRegistry)
.query(newObject()
.name("QueryType")
.field(newFieldDefinition()
.name("hero")
.type(GraphQLString)
))
}
def "schema builder copies extension definitions"() {
setup:
def schemaBuilder = basicSchemaBuilder()
def newDirective = Directive.newDirective().name("pizza").build()
def extension = SchemaExtensionDefinition.newSchemaExtensionDefinition().directive(newDirective).build()
def oldSchema = schemaBuilder.extensionDefinitions([extension]).build()
when:
def newSchema = GraphQLSchema.newSchema(oldSchema).build()
then:
oldSchema.extensionDefinitions.size() == 1
newSchema.extensionDefinitions.size() == 1
((Directive) oldSchema.extensionDefinitions.first().getDirectives().first()).name == "pizza"
((Directive) newSchema.extensionDefinitions.first().getDirectives().first()).name == "pizza"
}
def "all built-in directives are always present"() {
setup:
def schemaBuilder = basicSchemaBuilder()
when: "a schema is built"
def schema = schemaBuilder.build()
then: "all 7 built-in directives are present"
schema.directives.size() == 7
schema.getDirective("include") != null
schema.getDirective("skip") != null
schema.getDirective("deprecated") != null
schema.getDirective("specifiedBy") != null
schema.getDirective("oneOf") != null
schema.getDirective("defer") != null
schema.getDirective("experimental_disableErrorPropagation") != null
when: "the schema is transformed, things are copied"
schema = schema.transform({ builder -> builder })
then: "all 7 built-in directives are still present"
schema.directives.size() == 7
when: "clearDirectives is called"
schema = basicSchemaBuilder().clearDirectives().build()
then: "all 7 built-in directives are still present because ensureBuiltInDirectives re-adds them"
schema.directives.size() == 7
when: "clearDirectives is called and additional directives are added"
schema = basicSchemaBuilder().clearDirectives()
.additionalDirective(GraphQLDirective.newDirective()
.name("custom")
.validLocations(DirectiveLocation.FIELD)
.build())
.build()
then: "all 7 built-in directives are present plus the additional one"
schema.directives.size() == 8
schema.getDirective("custom") != null
}
def "clearDirectives supports replacing non-built-in directives in a schema transform"() {
given: "a schema with a custom directive"
def originalDirective = GraphQLDirective.newDirective()
.name("custom")
.description("v1")
.validLocations(DirectiveLocation.FIELD)
.build()
def schema = basicSchemaBuilder()
.additionalDirective(originalDirective)
.build()
assert schema.directives.size() == 8
when: "the schema is transformed to replace the custom directive"
def replacementDirective = GraphQLDirective.newDirective()
.name("custom")
.description("v2")
.validLocations(DirectiveLocation.FIELD)
.build()
def newSchema = schema.transform({ builder ->
def nonBuiltIns = schema.getDirectives().findAll { !Directives.isBuiltInDirective(it) }
.collect { it.getName() == "custom" ? replacementDirective : it }
builder.clearDirectives()
.additionalDirectives(new LinkedHashSet<>(nonBuiltIns))
})
then: "all 7 built-in directives are still present"
newSchema.directives.size() == 8
newSchema.getDirective("include") != null
newSchema.getDirective("skip") != null
newSchema.getDirective("deprecated") != null
and: "the custom directive has the updated description"
newSchema.getDirective("custom").description == "v2"
}
def "clearDirectives then adding directives gives expected ordering"() {
given: "a non-standard directive and a customized built-in directive"
def nonStandard = GraphQLDirective.newDirective()
.name("custom")
.validLocations(DirectiveLocation.FIELD)
.build()
def skipWithCustomDesc = Directives.SkipDirective.transform({ b ->
b.description("custom skip description")
})
when: "clearDirectives is called, then the non-standard directive is added, then the customized built-in is added after it"
def schema = basicSchemaBuilder()
.clearDirectives()
.additionalDirective(nonStandard)
.additionalDirective(skipWithCustomDesc)
.build()
then: "unoverridden built-ins come first (in BUILT_IN_DIRECTIVES order, skip excluded), then user-supplied in insertion order"
def names = schema.directives.collect { it.name }
names == ["include", "deprecated", "specifiedBy", "oneOf", "defer",
"experimental_disableErrorPropagation", "custom", "skip"]
and: "the customized skip directive retains its custom description"
schema.getDirective("skip").description == "custom skip description"
}
def "clear additional types works as expected"() {
setup:
def schemaBuilder = basicSchemaBuilder()
when: "no additional types have been specified"
def schema = schemaBuilder.build()
then:
schema.additionalTypes.size() == 0
when: "clear types is called"
schema = schemaBuilder.clearAdditionalTypes().build()
then:
schema.additionalTypes.empty
when: "clear types is called with additional types"
def additional1TypeName = "Additional1"
def additional2TypeName = "Additional2"
def fieldName = "field"
def additionalType1 = newObject()
.name(additional1TypeName)
.field(newFieldDefinition()
.name(fieldName)
.type(GraphQLString))
.build()
def additionalType2 = newObject()
.name("Additional2")
.field(newFieldDefinition()
.name(fieldName)
.type(GraphQLString))
.build()
def additional1Coordinates = FieldCoordinates.coordinates(additionalType1, fieldName)
DataFetcher<?> basicDataFetcher = new DataFetcher<Object>() {
@Override
Object get(DataFetchingEnvironment environment) throws Exception {
return null
}
}
GraphQLCodeRegistry codeRegistry = GraphQLCodeRegistry.newCodeRegistry()
.dataFetcher(additional1Coordinates, basicDataFetcher)
.build()
schema = schemaBuilder
.clearAdditionalTypes()
.additionalType(additionalType1)
.codeRegistry(codeRegistry)
.build()
then:
schema.additionalTypes.size() == 1
when: "the schema is transformed, things are copied"
def additional2Coordinates = FieldCoordinates.coordinates(additional2TypeName, fieldName)
codeRegistry = codeRegistry.transform({ builder -> builder.dataFetcher(additional2Coordinates, basicDataFetcher) })
schema = schema.transform({ builder -> builder.additionalType(additionalType2).codeRegistry(codeRegistry) })
then:
schema.additionalTypes.size() == 2
}
def "getType works as expected"() {
def sdl = '''
type Query {
field1 : Pet
field2 : UnionType
}
interface Pet {
name : String
}
type Dog implements Pet {
name : String
}
type Cat implements Pet {
name : String
}
union UnionType = Cat | Dog
'''
when:
def schema = TestUtil.schema(sdl)
then:
schema.containsType("Pet")
schema.containsType("Dog")
!schema.containsType("Elephant")
schema.getType("Pet") != null
GraphQLInterfaceType petType = schema.getTypeAs("Pet")
petType.getName() == "Pet"
GraphQLObjectType dogType = schema.getTypeAs("Dog")
dogType.getName() == "Dog"
}
def "issue with type references when original type is transformed away"() {
def sdl = '''
type Query {
# The b fields leads to the addition of the B type (actual definition)
b: B
# When we filter out the `b` field, we can still access B through A
# however they are GraphQLTypeReferences and not an actual GraphQL Object
a: A
}
type A {
b: B
}
type B {
a: A
b: B
}
'''
when:
def schema = TestUtil.schema(sdl)
// When field `b` is filtered out
List<GraphQLFieldDefinition> fields = schema.queryType.fieldDefinitions.stream().filter({
it.name == "a"
}).collect(toList())
// And we transform the schema's query root, the schema building
// will throw because type B won't be in the type map anymore, since
// there are no more actual B object types in the schema tree.
def transformed = schema.transform({
it.query(schema.queryType.transform({
it.replaceFields(fields)
}))
})
then:
transformed.containsType("B")
}
def "can change types via SchemaTransformer and visitor"() {
def sdl = '''
type Query {
b: B
a: A
}
type A {
b: B
}
type B {
a: A
b: B
}
'''
when:
def schema = TestUtil.schema(sdl)
GraphQLTypeVisitorStub visitor = new GraphQLTypeVisitorStub() {
@Override
TraversalControl visitGraphQLObjectType(GraphQLObjectType objectType, TraverserContext<GraphQLSchemaElement> context) {
if (objectType.getName() == "Query") {
def queryType = objectType
List<GraphQLFieldDefinition> fields = queryType.fieldDefinitions.stream().filter({
it.name == "a"
}).collect(toList())
GraphQLObjectType newObjectType = queryType.transform({
it.replaceFields(fields)
})
return changeNode(context, newObjectType)
}
return TraversalControl.CONTINUE
}
}
GraphQLSchema transformedSchema = SchemaTransformer.transformSchema(schema, visitor)
then:
transformedSchema.containsType("B")
}
def "fields edited from type references should still built valid schemas"() {
def typeB = newObject().name("B")
.field(newFieldDefinition().name("a").type(typeRef("A")))
.field(newFieldDefinition().name("b").type(typeRef("B")))
.build()
def typeAFieldB = newFieldDefinition().name("b").type(typeRef("B")).build()
// at the line above typeB is never strongly referenced
// and this simulates an edit situation that wont happen with direct java declaration
// but where the type reference is replaced to an actual but its the ONLY direct reference
// to that type``
typeAFieldB.replaceType(typeB)
def typeA = newObject().name("A")
.field(typeAFieldB)
.build()
//
// the same pattern above applies ot other replaceable types like arguments and input fields
def inputTypeY = newInputObject().name("InputTypeY")
.field(newInputObjectField().name("in2").type(GraphQLString))
.build()
def inputFieldOfY = newInputObjectField().name("inY").type(typeRef("InputTypeY")).build()
// only reference to InputTypeY
inputFieldOfY.replaceType(inputTypeY)
def inputTypeZ = newInputObject().name("InputTypeZ")
.field(inputFieldOfY)
.build()
def inputTypeX = newInputObject().name("InputTypeX")
.field(newInputObjectField().name("inX").type(GraphQLString))
.build()
GraphQLArgument argOfX = newArgument().name("argOfX").type(typeRef("InputTypeX")).build()
// only reference to InputTypeX
argOfX.replaceType(inputTypeX)
GraphQLArgument argOfZ = newArgument().name("argOfZ").type(inputTypeZ).build()
def typeC = newObject().name("C")
.field(newFieldDefinition().name("f1").type(GraphQLString).argument(argOfX))
.field(newFieldDefinition().name("f2").type(GraphQLString).argument(argOfZ))
.build()
def queryType = newObject().name("Query")
.field(newFieldDefinition().name("a").type(typeA))
.field(newFieldDefinition().name("c").type(typeC))
.build()
when:
def schema = GraphQLSchema.newSchema().query(queryType).build()
then:
schema.getType("A") != null
schema.getType("B") != null
schema.getType("InputTypeX") != null
schema.getType("InputTypeY") != null
schema.getType("InputTypeZ") != null
}
def "list and non nulls work when direct references are edited"() {
def typeX = newObject().name("TypeX")
.field(newFieldDefinition().name("f1").type(GraphQLString))
.build()
def queryType = newObject().name("Query")
.field(newFieldDefinition().name("direct").type(typeX))
.field(newFieldDefinition().name("indirectNonNull").type(nonNull(typeRef("TypeX"))))
.field(newFieldDefinition().name("indirectList").type(GraphQLList.list(nonNull(typeRef("TypeX")))))
.build()
when:
def schema = GraphQLSchema.newSchema().query(queryType).build()
then:
schema.getType("TypeX") != null
// now edit away the actual strong reference
when:
GraphQLTypeVisitor visitor = new GraphQLTypeVisitorStub() {
@Override
TraversalControl visitGraphQLFieldDefinition(GraphQLFieldDefinition node, TraverserContext<GraphQLSchemaElement> context) {
if (node.getName() == "direct") {
return deleteNode(context)
}
return TraversalControl.CONTINUE
}
}
GraphQLSchema transformedSchema = SchemaTransformer.transformSchema(schema, visitor)
then:
transformedSchema.getType("TypeX") != null
}
def "cheap transform without types transformation works"() {
def sdl = '''
"a schema involving pets"
schema {
query : Query
}
type Query {
field1 : Dog
field2 : Cat
}
type Dog {
name : String
}
type Cat {
name : String
}
'''
when:
DataFetcher nameDF = { env -> "name" }
def originalSchema = TestUtil.schema(sdl, ["Dog": ["name": nameDF]])
def originalCodeRegistry = originalSchema.getCodeRegistry()
then:
originalSchema.getDescription() == "a schema involving pets"
originalSchema.containsType("Dog")
!originalSchema.containsType("Elephant")
originalCodeRegistry.getDataFetcher(originalSchema.getObjectType("Dog"), originalSchema.getObjectType("Dog").getField("name")) === nameDF
when:
def newRegistry = originalCodeRegistry.transform({ bld -> bld.clearDataFetchers() })
def newSchema = originalSchema.transformWithoutTypes({
it.description("A new home for pets").codeRegistry(newRegistry)
})
then:
newSchema.getDescription() == "A new home for pets"
newSchema.containsType("Dog")
!newSchema.containsType("Elephant")
def dogType = newSchema.getObjectType("Dog")
dogType === originalSchema.getObjectType("Dog") // schema type graph is the same
newRegistry == newSchema.getCodeRegistry()
newRegistry != originalCodeRegistry
def newDF = newRegistry.getDataFetcher(dogType, dogType.getField("name"))
newDF !== nameDF
newDF instanceof LightDataFetcher // defaulted in
}
def "can get by field co-ordinate"() {
when:
def fieldDef = starWarsSchema.getFieldDefinition(FieldCoordinates.coordinates("QueryType", "hero"))
then:
fieldDef.name == "hero"
(fieldDef.type as GraphQLInterfaceType).getName() == "Character"
when:
fieldDef = starWarsSchema.getFieldDefinition(FieldCoordinates.coordinates("X", "hero"))
then:
fieldDef == null
when:
fieldDef = starWarsSchema.getFieldDefinition(FieldCoordinates.coordinates("QueryType", "X"))
then:
fieldDef == null
when:
starWarsSchema.getFieldDefinition(FieldCoordinates.coordinates("Episode", "JEDI"))
then:
thrown(AssertException)
when:
fieldDef = starWarsSchema.getFieldDefinition(FieldCoordinates.systemCoordinates("__typename"))
then:
fieldDef == starWarsSchema.getIntrospectionTypenameFieldDefinition()
when:
fieldDef = starWarsSchema.getFieldDefinition(FieldCoordinates.systemCoordinates("__type"))
then:
fieldDef == starWarsSchema.getIntrospectionTypeFieldDefinition()
when:
fieldDef = starWarsSchema.getFieldDefinition(FieldCoordinates.systemCoordinates("__schema"))
then:
fieldDef == starWarsSchema.getIntrospectionSchemaFieldDefinition()
when:
starWarsSchema.getFieldDefinition(FieldCoordinates.systemCoordinates("__junk"))
then:
thrown(AssertException)
}
def "additionalTypes can contain any type when building programmatically - not restricted to detached types"() {
given: "types that will be directly reachable from Query"
def simpleType = newObject()
.name("SimpleType")
.field(newFieldDefinition()
.name("name")
.type(GraphQLString))
.build()
def simpleInputType = newInputObject()
.name("SimpleInput")
.field(newInputObjectField()
.name("value")
.type(GraphQLString))
.build()
def simpleInterface = GraphQLInterfaceType.newInterface()
.name("SimpleInterface")
.field(newFieldDefinition()
.name("id")
.type(GraphQLString))
.build()
def simpleUnion = GraphQLUnionType.newUnionType()
.name("SimpleUnion")
.possibleType(simpleType)
.build()
def simpleEnum = GraphQLEnumType.newEnum()
.name("SimpleEnum")
.value("VALUE_A")
.value("VALUE_B")
.build()
def simpleScalar = GraphQLScalarType.newScalar()
.name("SimpleScalar")
.coercing(new Coercing() {
@Override
Object serialize(Object dataFetcherResult) { return dataFetcherResult }
@Override
Object parseValue(Object input) { return input }
@Override
Object parseLiteral(Object input) { return input }
})
.build()
and: "a query type that references all these types directly"
def queryType = newObject()
.name("Query")
.field(newFieldDefinition()
.name("simpleField")
.type(simpleType))
.field(newFieldDefinition()
.name("interfaceField")
.type(simpleInterface))
.field(newFieldDefinition()
.name("unionField")
.type(simpleUnion))
.field(newFieldDefinition()
.name("enumField")
.type(simpleEnum))
.field(newFieldDefinition()
.name("scalarField")
.type(simpleScalar))
.field(newFieldDefinition()
.name("inputField")
.type(GraphQLString)
.argument(newArgument()
.name("input")
.type(simpleInputType)))
.build()
def codeRegistry = GraphQLCodeRegistry.newCodeRegistry()
.typeResolver(simpleInterface, { env -> simpleType })
.typeResolver(simpleUnion, { env -> simpleType })
.build()
when: "we add ALL types (including already reachable ones) as additionalTypes"
def schema = GraphQLSchema.newSchema()
.query(queryType)
.codeRegistry(codeRegistry)
.additionalType(simpleType) // already reachable via Query.simpleField
.additionalType(simpleInputType) // already reachable via Query.inputField argument
.additionalType(simpleInterface) // already reachable via Query.interfaceField
.additionalType(simpleUnion) // already reachable via Query.unionField
.additionalType(simpleEnum) // already reachable via Query.enumField
.additionalType(simpleScalar) // already reachable via Query.scalarField
.build()
then: "schema builds successfully - no restriction on what can be in additionalTypes"
schema != null
and: "all types are in the type map (as expected)"
schema.getType("SimpleType") == simpleType
schema.getType("SimpleInput") == simpleInputType
schema.getType("SimpleInterface") == simpleInterface
schema.getType("SimpleUnion") == simpleUnion
schema.getType("SimpleEnum") == simpleEnum
schema.getType("SimpleScalar") == simpleScalar
and: "additionalTypes contains all types we added - even though they were already reachable"
schema.getAdditionalTypes().size() == 6
schema.getAdditionalTypes().contains(simpleType)
schema.getAdditionalTypes().contains(simpleInputType)
schema.getAdditionalTypes().contains(simpleInterface)
schema.getAdditionalTypes().contains(simpleUnion)
schema.getAdditionalTypes().contains(simpleEnum)
schema.getAdditionalTypes().contains(simpleScalar)
}
}