@@ -10,6 +10,7 @@ def get_introspection_query_ast(
1010 specified_by_url : bool = False ,
1111 directive_is_repeatable : bool = False ,
1212 schema_description : bool = False ,
13+ input_value_deprecation : bool = False ,
1314 type_recursion_level : int = 7 ,
1415) -> DocumentNode :
1516 """Get a query for introspection as a document using the DSL module.
@@ -43,13 +44,20 @@ def get_introspection_query_ast(
4344
4445 directives = ds .__Schema .directives .select (ds .__Directive .name )
4546
47+ deprecated_expand = {}
48+
49+ if input_value_deprecation :
50+ deprecated_expand = {
51+ "includeDeprecated" : True ,
52+ }
53+
4654 if descriptions :
4755 directives .select (ds .__Directive .description )
4856 if directive_is_repeatable :
4957 directives .select (ds .__Directive .isRepeatable )
5058 directives .select (
5159 ds .__Directive .locations ,
52- ds .__Directive .args .select (fragment_InputValue ),
60+ ds .__Directive .args ( ** deprecated_expand ) .select (fragment_InputValue ),
5361 )
5462
5563 schema .select (directives )
@@ -69,7 +77,7 @@ def get_introspection_query_ast(
6977 fields .select (ds .__Field .description )
7078
7179 fields .select (
72- ds .__Field .args .select (fragment_InputValue ),
80+ ds .__Field .args ( ** deprecated_expand ) .select (fragment_InputValue ),
7381 ds .__Field .type .select (fragment_TypeRef ),
7482 ds .__Field .isDeprecated ,
7583 ds .__Field .deprecationReason ,
@@ -89,7 +97,7 @@ def get_introspection_query_ast(
8997
9098 fragment_FullType .select (
9199 fields ,
92- ds .__Type .inputFields .select (fragment_InputValue ),
100+ ds .__Type .inputFields ( ** deprecated_expand ) .select (fragment_InputValue ),
93101 ds .__Type .interfaces .select (fragment_TypeRef ),
94102 enum_values ,
95103 ds .__Type .possibleTypes .select (fragment_TypeRef ),
@@ -105,6 +113,12 @@ def get_introspection_query_ast(
105113 ds .__InputValue .defaultValue ,
106114 )
107115
116+ if input_value_deprecation :
117+ fragment_InputValue .select (
118+ ds .__InputValue .isDeprecated ,
119+ ds .__InputValue .deprecationReason ,
120+ )
121+
108122 fragment_TypeRef .select (
109123 ds .__Type .kind ,
110124 ds .__Type .name ,
0 commit comments