@@ -16,6 +16,10 @@ export type IntrospectionOptions = {|
16
16
// Whether to include `description` field on schema.
17
17
// Default: false
18
18
schemaDescription ? : boolean ,
19
+
20
+ // Whether target GraphQL server support deprecation of input values.
21
+ // Default: false
22
+ inputValueDeprecation ? : boolean ,
19
23
| } ;
20
24
21
25
export function getIntrospectionQuery ( options ?: IntrospectionOptions ) : string {
@@ -24,6 +28,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
24
28
specifiedByUrl : false ,
25
29
directiveIsRepeatable : false ,
26
30
schemaDescription : false ,
31
+ inputValueDeprecation : false ,
27
32
...options ,
28
33
} ;
29
34
@@ -38,6 +43,10 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
38
43
? descriptions
39
44
: '' ;
40
45
46
+ function inputDeprecation ( str ) {
47
+ return optionsWithDefault . inputValueDeprecation ? str : '' ;
48
+ }
49
+
41
50
return `
42
51
query IntrospectionQuery {
43
52
__schema {
@@ -53,7 +62,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
53
62
${ descriptions }
54
63
${ directiveIsRepeatable }
55
64
locations
56
- args {
65
+ args${ inputDeprecation ( '(includeDeprecated: true)' ) } {
57
66
...InputValue
58
67
}
59
68
}
@@ -68,7 +77,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
68
77
fields(includeDeprecated: true) {
69
78
name
70
79
${ descriptions }
71
- args {
80
+ args${ inputDeprecation ( '(includeDeprecated: true)' ) } {
72
81
...InputValue
73
82
}
74
83
type {
@@ -77,7 +86,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
77
86
isDeprecated
78
87
deprecationReason
79
88
}
80
- inputFields {
89
+ inputFields${ inputDeprecation ( '(includeDeprecated: true)' ) } {
81
90
...InputValue
82
91
}
83
92
interfaces {
@@ -99,6 +108,8 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
99
108
${ descriptions }
100
109
type { ...TypeRef }
101
110
defaultValue
111
+ ${ inputDeprecation ( 'isDeprecated' ) }
112
+ ${ inputDeprecation ( 'deprecationReason' ) }
102
113
}
103
114
104
115
fragment TypeRef on __Type {
@@ -280,6 +291,8 @@ export type IntrospectionInputValue = {|
280
291
+ description ?: ?string ,
281
292
+ type : IntrospectionInputTypeRef ,
282
293
+ defaultValue : ?string ,
294
+ + isDeprecated ?: boolean ,
295
+ + deprecationReason ?: ?string ,
283
296
| } ;
284
297
285
298
export type IntrospectionEnumValue = { |
0 commit comments