fetchAllTypes function
Every type reachable from schema, plus specifiedTypes.
The three root operation types are walked transitively, so a type only
mentioned deep inside a field still turns up. This is what introspection
answers __schema { types } with.
Implementation
List<GraphQLType?> fetchAllTypes(
GraphQLSchema schema,
List<GraphQLType?> specifiedTypes,
) {
var data = <GraphQLType?>{}
..add(schema.queryType)
..addAll(specifiedTypes);
if (schema.mutationType != null) {
data.add(schema.mutationType);
}
if (schema.subscriptionType != null) {
data.add(schema.subscriptionType);
}
return CollectTypes(data).types.toList();
}