From 054b96d4f4657659402856f0526c787cc9788857 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 3 Aug 2018 13:48:54 -0400 Subject: [PATCH] Allow includeDeprecated on __type --- graphql_server/lib/introspection.dart | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/graphql_server/lib/introspection.dart b/graphql_server/lib/introspection.dart index ccb9a5bf..9901905e 100644 --- a/graphql_server/lib/introspection.dart +++ b/graphql_server/lib/introspection.dart @@ -155,7 +155,19 @@ GraphQLObjectType _createTypeType() { field( 'fields', type: listType(fieldType), - resolve: (type, _) => type is GraphQLObjectType ? type.fields : [], + arguments: [ + new GraphQLFieldArgument( + 'includeDeprecated', + graphQLBoolean, + defaultValue: false, + ), + ], + resolve: (type, args) => type is GraphQLObjectType + ? type.fields + .where( + (f) => !f.isDeprecated || args['includeDeprecated'] == true) + .toList() + : [], ), ]); }