Allow includeDeprecated on __type

This commit is contained in:
Tobe O 2018-08-03 13:48:54 -04:00
parent 66e1b4a9b1
commit 054b96d4f4

View file

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