fetchAllNamedTypes function

Set<GraphQLNamedType> fetchAllNamedTypes(
  1. GraphQLSchema schema
)

Returns a Set of all named types in the schema

Implementation

Set<GraphQLNamedType> fetchAllNamedTypes(GraphQLSchema schema) {
  final data = <GraphQLType>[
    ...schema.otherTypes,
    if (schema.queryType != null) schema.queryType!,
    if (schema.mutationType != null) schema.mutationType!,
    if (schema.subscriptionType != null) schema.subscriptionType!,
    ...schema.directives.expand(
      (directive) => directive.inputs.map((e) => e.type),
    ),
    schemaGraphQLType,
  ];

  return CollectTypes(data).traversedTypes;
}