2018-08-02 13:31:54 +00:00
|
|
|
library graphql_schema.src.schema;
|
|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
part 'argument.dart';
|
|
|
|
part 'field.dart';
|
|
|
|
part 'gen.dart';
|
|
|
|
part 'object_type.dart';
|
|
|
|
part 'scalar.dart';
|
|
|
|
part 'type.dart';
|
|
|
|
part 'validation_result.dart';
|
|
|
|
|
|
|
|
class GraphQLSchema {
|
|
|
|
final GraphQLObjectType query;
|
|
|
|
final GraphQLObjectType mutation;
|
2018-08-03 18:31:50 +00:00
|
|
|
final GraphQLObjectType subscription;
|
2018-08-02 13:31:54 +00:00
|
|
|
|
2018-08-03 18:31:50 +00:00
|
|
|
GraphQLSchema({this.query, this.mutation, this.subscription});
|
2018-08-02 13:31:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GraphQLSchema graphQLSchema(
|
2018-08-03 18:31:50 +00:00
|
|
|
{@required GraphQLObjectType query, GraphQLObjectType mutation, GraphQLObjectType subscription}) =>
|
|
|
|
new GraphQLSchema(query: query, mutation: mutation, subscription: subscription);
|
2018-08-02 15:17:14 +00:00
|
|
|
|
|
|
|
/// A default resolver that always returns `null`.
|
|
|
|
resolveToNull(_, __) => null;
|
2018-08-02 18:33:50 +00:00
|
|
|
|
|
|
|
class GraphQLException extends FormatException {
|
|
|
|
GraphQLException(String message) : super(message);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => 'GraphQL exception: $message';
|
|
|
|
}
|