@@ -134,8 +134,7 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
134134 .definition(definition)
135135 .description(getDocumentation(definition))
136136
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 ))
139138
140139 definition.implements.forEach { implementsDefinition ->
141140 val interfaceName = (implementsDefinition as TypeName ).name
@@ -177,6 +176,8 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
177176 .definition(definition)
178177 .description(getDocumentation(definition))
179178
179+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .INPUT_OBJECT ))
180+
180181 definition.inputValueDefinitions.forEach { inputDefinition ->
181182 builder.field { field ->
182183 field.name(inputDefinition.name)
@@ -187,7 +188,7 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
187188 }
188189 }
189190
190- return builder.build()
191+ return directiveGenerator.onInputObject( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
191192 }
192193
193194 private fun createEnumObject (definition : EnumTypeDefinition ): GraphQLEnumType {
@@ -200,6 +201,8 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
200201 .definition(definition)
201202 .description(getDocumentation(definition))
202203
204+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .ENUM ))
205+
203206 definition.enumValueDefinitions.forEach { enumDefinition ->
204207 val enumName = enumDefinition.name
205208 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
211214 }
212215 }
213216
214- return builder.build()
217+ return directiveGenerator.onEnum( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
215218 }
216219
217220 private fun createInterfaceObject (definition : InterfaceTypeDefinition ): GraphQLInterfaceType {
@@ -222,11 +225,13 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
222225 .description(getDocumentation(definition))
223226 .typeResolver(TypeResolverProxy ())
224227
228+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .INTERFACE ))
229+
225230 definition.fieldDefinitions.forEach { fieldDefinition ->
226231 builder.field { field -> createField(field, fieldDefinition) }
227232 }
228233
229- return builder.build()
234+ return directiveGenerator.onInterface( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
230235 }
231236
232237 private fun createUnionObject (definition : UnionTypeDefinition , types : List <GraphQLObjectType >): GraphQLUnionType {
@@ -237,8 +242,10 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
237242 .description(getDocumentation(definition))
238243 .typeResolver(TypeResolverProxy ())
239244
245+ builder.withDirectives(* buildDirectives(definition.directives, setOf (), Introspection .DirectiveLocation .UNION ))
246+
240247 getLeafUnionObjects(definition, types).forEach { builder.possibleType(it) }
241- return builder.build()
248+ return directiveGenerator.onUnion( builder.build(), DirectiveBehavior . Params (runtimeWiring) )
242249 }
243250
244251 private fun getLeafUnionObjects (definition : UnionTypeDefinition , types : List <GraphQLObjectType >): List <GraphQLObjectType > {
0 commit comments