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() + : [], ), ]); }