typeIntrospectionTypeField top-level property

GraphQLObjectField<GraphQLType, Map<String, Object?>, Object?> typeIntrospectionTypeField
final

The type introspection type GraphQLObjectField

Implementation

final typeIntrospectionTypeField = _reflectTypeType().field(
  '__type',
  inputs: [GraphQLFieldInput('name', graphQLString.nonNull())],
  resolve: (_, ctx) {
    final name = ctx.args['name'] as String?;
    final type = ctx.executionCtx.schema.typeMap[name];
    if (type == null) {
      throw GraphQLException.fromMessage('No type named "$name" exists.');
    }
    return type;
  },
);