part of graphql_schema.src.schema; typedef FutureOr GraphQLFieldResolver( Serialized serialized, Map argumentValues); class GraphQLObjectField { final List inputs = []; final String name; final GraphQLFieldResolver resolve; final GraphQLType type; final String description; final String deprecationReason; GraphQLObjectField(this.name, this.type, {Iterable arguments: const [], @required this.resolve, this.deprecationReason, this.description}) { assert(type != null, 'GraphQL fields must specify a `type`.'); // assert( // resolve != null, 'GraphQL fields must specify a `resolve` callback.'); this.inputs.addAll(arguments ?? []); } bool get isDeprecated => deprecationReason?.isNotEmpty == true; FutureOr serialize(Value value) { return type.serialize(value); } FutureOr deserialize(Serialized serialized, [Map argumentValues = const {}]) { if (resolve != null) return resolve(serialized, argumentValues); return type.deserialize(serialized); } @override bool operator ==(other) => other is GraphQLObjectField && other.name == name && other.deprecationReason == deprecationReason && other.type == type && other.resolve == resolve && const ListEquality().equals(other.inputs, inputs); }