@@ -93,6 +93,45 @@ let __Directive = try! GraphQLObjectType(
93
93
return directive. args
94
94
}
95
95
) ,
96
+ // NOTE: the following three fields are deprecated and are no longer part
97
+ // of the GraphQL specification.
98
+ " onOperation " : GraphQLField (
99
+ type: GraphQLNonNull ( GraphQLBoolean) ,
100
+ deprecationReason: " Use `locations`. " ,
101
+ resolve: { directive, _, _, _ in
102
+ guard let d = directive as? GraphQLDirective else {
103
+ return nil
104
+ }
105
+
106
+ return d. locations. contains ( . query) ||
107
+ d. locations. contains ( . mutation) ||
108
+ d. locations. contains ( . subscription)
109
+ }
110
+ ) ,
111
+ " onFragment " : GraphQLField (
112
+ type: GraphQLNonNull ( GraphQLBoolean) ,
113
+ deprecationReason: " Use `locations`. " ,
114
+ resolve: { directive, _, _, _ in
115
+ guard let d = directive as? GraphQLDirective else {
116
+ return nil
117
+ }
118
+
119
+ return d. locations. contains ( . fragmentSpread) ||
120
+ d. locations. contains ( . inlineFragment) ||
121
+ d. locations. contains ( . fragmentDefinition)
122
+ }
123
+ ) ,
124
+ " onField " : GraphQLField (
125
+ type: GraphQLNonNull ( GraphQLBoolean) ,
126
+ deprecationReason: " Use `locations`. " ,
127
+ resolve: { directive, _, _, _ in
128
+ guard let d = directive as? GraphQLDirective else {
129
+ return nil
130
+ }
131
+
132
+ return d. locations. contains ( . field)
133
+ }
134
+ ) ,
96
135
]
97
136
)
98
137
@@ -274,7 +313,7 @@ let __Type: GraphQLObjectType = try! GraphQLObjectType(
274
313
if !arguments[ " includeDeprecated " ] . bool! {
275
314
values = values. filter ( { !$0. isDeprecated } )
276
315
}
277
-
316
+
278
317
return values
279
318
}
280
319
@@ -288,7 +327,7 @@ let __Type: GraphQLObjectType = try! GraphQLObjectType(
288
327
let fieldMap = type. fields
289
328
return Array ( fieldMap. values) . sorted ( by: { $0. name < $1. name } )
290
329
}
291
-
330
+
292
331
return nil
293
332
}
294
333
) ,
0 commit comments