From 75556461d032c4c65e8c3d9c9841881f81c49205 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Apr 2019 11:15:40 -0400 Subject: [PATCH] Bump server -> beta.3 --- graphql_server/README.md | 22 +++++++++++++++++++++- graphql_server/lib/introspection.dart | 5 +++++ graphql_server/pubspec.yaml | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/graphql_server/README.md b/graphql_server/README.md index c554fe0d..b86c3122 100644 --- a/graphql_server/README.md +++ b/graphql_server/README.md @@ -73,4 +73,24 @@ await server.done; ``` See `graphQLWS` in `package:angel_graphql` for a good example: -https://github.com/angel-dart/graphql/blob/master/angel_graphql/lib/src/graphql_ws.dart \ No newline at end of file +https://github.com/angel-dart/graphql/blob/master/angel_graphql/lib/src/graphql_ws.dart + +## Introspection +Introspection of a GraphQL schema allows clients to query the schema itself, +and get information about the response the server expects. The `GraphQL` +class handles this automatically, so you don't have to write any code for it. + +However, you can call the `reflectSchema` method to manually reflect a schema: +https://pub.dartlang.org/documentation/graphql_server/latest/introspection/reflectSchema.html + +## Mirrors Usage +By default, `dart:mirrors` is not required, but it can be optionally used. + +The `mirrorsFieldResolver` can resolve fields from concrete objects, instead of you +first having to serialize them: +https://pub.dartlang.org/documentation/graphql_server/latest/graphql_server.mirrors/mirrorsFieldResolver.html + +You can also use `convertDartType` to convert a concrete Dart type into a `GraphQLType`. However, +the ideal choice is `package:graphql_generator`. +* https://pub.dartlang.org/documentation/graphql_server/latest/graphql_server.mirrors/convertDartType.html +* https://pub.dartlang.org/packages/graphql_generator \ No newline at end of file diff --git a/graphql_server/lib/introspection.dart b/graphql_server/lib/introspection.dart index a748d215..ce750a99 100644 --- a/graphql_server/lib/introspection.dart +++ b/graphql_server/lib/introspection.dart @@ -1,6 +1,11 @@ import 'package:graphql_parser/graphql_parser.dart'; import 'package:graphql_schema/graphql_schema.dart'; +/// Performs introspection over a GraphQL [schema], and returns a new one, containing +/// introspective information. +/// +/// [allTypes] should contain all types, not directly defined in the schema, that you +/// would like to have introspection available for. GraphQLSchema reflectSchema(GraphQLSchema schema, List allTypes) { for (var type in allTypes.toList()) { var custom = _fetchAllTypesFromType(type); diff --git a/graphql_server/pubspec.yaml b/graphql_server/pubspec.yaml index a675cf03..819726a3 100644 --- a/graphql_server/pubspec.yaml +++ b/graphql_server/pubspec.yaml @@ -1,5 +1,5 @@ name: graphql_server -version: 1.0.0-beta.2 +version: 1.0.0-beta.3 author: Tobe O description: Base package for implementing GraphQL servers. You might prefer `package:angel_graphql`, the fastest way to implement GraphQL backends in Dart. homepage: https://github.com/angel-dart/graphql