printFilteredSchema method

String printFilteredSchema(
  1. GraphQLSchema schema,
  2. bool directiveFilter(
    1. GraphQLDirective
    ),
  3. bool typeFilter(
    1. GraphQLNamedType
    )
)

Implementation

String printFilteredSchema(
  GraphQLSchema schema,
  bool Function(GraphQLDirective) directiveFilter,
  bool Function(GraphQLNamedType) typeFilter,
) {
  final directives = schema.directives.where(directiveFilter);
  final types = fetchAllNamedTypes(schema).where(typeFilter);

  return [
    printSchemaDefinition(schema),
    ...directives.map((directive) => printDirective(directive)),
    ...types.map((type) => printType(type)),
  ].whereType<Object>().join('\n\n');
}