@@ -134,8 +134,7 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
134
134
.definition(definition)
135
135
.description(getDocumentation(definition))
136
136
137
- val directiveDefinitions = setOf<GraphQLDirective >()
138
- builder.withDirectives(* buildDirectives(definition.directives, directiveDefinitions, Introspection .DirectiveLocation .OBJECT ))
137
+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .OBJECT ))
139
138
140
139
definition.implements.forEach { implementsDefinition ->
141
140
val interfaceName = (implementsDefinition as TypeName ).name
@@ -177,6 +176,8 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
177
176
.definition(definition)
178
177
.description(getDocumentation(definition))
179
178
179
+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .INPUT_OBJECT ))
180
+
180
181
definition.inputValueDefinitions.forEach { inputDefinition ->
181
182
builder.field { field ->
182
183
field.name(inputDefinition.name)
@@ -187,7 +188,7 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
187
188
}
188
189
}
189
190
190
- return builder.build()
191
+ return directiveGenerator.onInputObject( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
191
192
}
192
193
193
194
private fun createEnumObject (definition : EnumTypeDefinition ): GraphQLEnumType {
@@ -200,6 +201,8 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
200
201
.definition(definition)
201
202
.description(getDocumentation(definition))
202
203
204
+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .ENUM ))
205
+
203
206
definition.enumValueDefinitions.forEach { enumDefinition ->
204
207
val enumName = enumDefinition.name
205
208
val enumValue = type.unwrap().enumConstants.find { (it as Enum <* >).name == enumName } ? : throw SchemaError (" Expected value for name '$enumName ' in enum '${type.unwrap().simpleName} ' but found none!" )
@@ -211,7 +214,7 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
211
214
}
212
215
}
213
216
214
- return builder.build()
217
+ return directiveGenerator.onEnum( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
215
218
}
216
219
217
220
private fun createInterfaceObject (definition : InterfaceTypeDefinition ): GraphQLInterfaceType {
@@ -222,11 +225,13 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
222
225
.description(getDocumentation(definition))
223
226
.typeResolver(TypeResolverProxy ())
224
227
228
+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .INTERFACE ))
229
+
225
230
definition.fieldDefinitions.forEach { fieldDefinition ->
226
231
builder.field { field -> createField(field, fieldDefinition) }
227
232
}
228
233
229
- return builder.build()
234
+ return directiveGenerator.onInterface( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
230
235
}
231
236
232
237
private fun createUnionObject (definition : UnionTypeDefinition , types : List <GraphQLObjectType >): GraphQLUnionType {
@@ -237,8 +242,10 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
237
242
.description(getDocumentation(definition))
238
243
.typeResolver(TypeResolverProxy ())
239
244
245
+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .UNION ))
246
+
240
247
getLeafUnionObjects(definition, types).forEach { builder.possibleType(it) }
241
- return builder.build()
248
+ return directiveGenerator.onUnion( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
242
249
}
243
250
244
251
private fun getLeafUnionObjects (definition : UnionTypeDefinition , types : List <GraphQLObjectType >): List <GraphQLObjectType > {
0 commit comments