@@ -10,6 +10,7 @@ def get_introspection_query_ast(
10
10
specified_by_url : bool = False ,
11
11
directive_is_repeatable : bool = False ,
12
12
schema_description : bool = False ,
13
+ input_value_deprecation : bool = False ,
13
14
type_recursion_level : int = 7 ,
14
15
) -> DocumentNode :
15
16
"""Get a query for introspection as a document using the DSL module.
@@ -43,13 +44,20 @@ def get_introspection_query_ast(
43
44
44
45
directives = ds .__Schema .directives .select (ds .__Directive .name )
45
46
47
+ deprecated_expand = {}
48
+
49
+ if input_value_deprecation :
50
+ deprecated_expand = {
51
+ "includeDeprecated" : True ,
52
+ }
53
+
46
54
if descriptions :
47
55
directives .select (ds .__Directive .description )
48
56
if directive_is_repeatable :
49
57
directives .select (ds .__Directive .isRepeatable )
50
58
directives .select (
51
59
ds .__Directive .locations ,
52
- ds .__Directive .args .select (fragment_InputValue ),
60
+ ds .__Directive .args ( ** deprecated_expand ) .select (fragment_InputValue ),
53
61
)
54
62
55
63
schema .select (directives )
@@ -69,7 +77,7 @@ def get_introspection_query_ast(
69
77
fields .select (ds .__Field .description )
70
78
71
79
fields .select (
72
- ds .__Field .args .select (fragment_InputValue ),
80
+ ds .__Field .args ( ** deprecated_expand ) .select (fragment_InputValue ),
73
81
ds .__Field .type .select (fragment_TypeRef ),
74
82
ds .__Field .isDeprecated ,
75
83
ds .__Field .deprecationReason ,
@@ -89,7 +97,7 @@ def get_introspection_query_ast(
89
97
90
98
fragment_FullType .select (
91
99
fields ,
92
- ds .__Type .inputFields .select (fragment_InputValue ),
100
+ ds .__Type .inputFields ( ** deprecated_expand ) .select (fragment_InputValue ),
93
101
ds .__Type .interfaces .select (fragment_TypeRef ),
94
102
enum_values ,
95
103
ds .__Type .possibleTypes .select (fragment_TypeRef ),
@@ -105,6 +113,12 @@ def get_introspection_query_ast(
105
113
ds .__InputValue .defaultValue ,
106
114
)
107
115
116
+ if input_value_deprecation :
117
+ fragment_InputValue .select (
118
+ ds .__InputValue .isDeprecated ,
119
+ ds .__InputValue .deprecationReason ,
120
+ )
121
+
108
122
fragment_TypeRef .select (
109
123
ds .__Type .kind ,
110
124
ds .__Type .name ,
0 commit comments