Skip to content

Commit 5128006

Browse files
committed
Remove DirectiveBehavior.kt as it is no longer necessary
1 parent 7c3e9fa commit 5128006

File tree

2 files changed

+11
-43
lines changed

2 files changed

+11
-43
lines changed

src/main/kotlin/graphql/kickstart/tools/DirectiveBehavior.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/main/kotlin/graphql/kickstart/tools/SchemaParser.kt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.kickstart.tools
22

33
import graphql.introspection.Introspection
4+
import graphql.kickstart.tools.directive.SchemaGeneratorDirectiveHelper
45
import graphql.kickstart.tools.util.getExtendedFieldDefinitions
56
import graphql.kickstart.tools.util.unwrap
67
import graphql.language.*
@@ -59,11 +60,12 @@ class SchemaParser internal constructor(
5960
private val permittedTypesForInputObject: Set<String> =
6061
(inputObjectDefinitions.map { it.name } + enumDefinitions.map { it.name }).toSet()
6162

62-
private val schemaGeneratorHelper = SchemaGeneratorHelper()
63-
private val directiveGenerator = DirectiveBehavior()
64-
6563
private val codeRegistryBuilder = GraphQLCodeRegistry.newCodeRegistry()
6664

65+
private val schemaGeneratorHelper = SchemaGeneratorHelper()
66+
private val schemaGeneratorDirectiveHelper = SchemaGeneratorDirectiveHelper()
67+
private val schemaDirectiveParameters = SchemaGeneratorDirectiveHelper.Parameters(null, runtimeWiring, null, codeRegistryBuilder)
68+
6769
/**
6870
* Parses the given schema with respect to the given dictionary and returns GraphQL objects.
6971
*/
@@ -152,8 +154,9 @@ class SchemaParser internal constructor(
152154
}
153155

154156
val objectType = builder.build()
157+
val directiveHelperParameters = SchemaGeneratorDirectiveHelper.Parameters(null, runtimeWiring, null, codeRegistryBuilder)
155158

156-
return directiveGenerator.onObject(objectType, DirectiveBehavior.Params(runtimeWiring, codeRegistryBuilder))
159+
return schemaGeneratorDirectiveHelper.onObject(objectType, directiveHelperParameters)
157160
}
158161

159162
private fun buildDirectives(directives: List<Directive>, directiveDefinitions: Set<GraphQLDirective>, directiveLocation: Introspection.DirectiveLocation): Array<GraphQLDirective> {
@@ -188,7 +191,7 @@ class SchemaParser internal constructor(
188191
builder.field(fieldBuilder.build())
189192
}
190193

191-
return directiveGenerator.onInputObject(builder.build(), DirectiveBehavior.Params(runtimeWiring, codeRegistryBuilder))
194+
return schemaGeneratorDirectiveHelper.onInputObjectType(builder.build(), schemaDirectiveParameters)
192195
}
193196

194197
private fun createEnumObject(definition: EnumTypeDefinition): GraphQLEnumType {
@@ -224,7 +227,7 @@ class SchemaParser internal constructor(
224227
}
225228
}
226229

227-
return directiveGenerator.onEnum(builder.build(), DirectiveBehavior.Params(runtimeWiring, codeRegistryBuilder))
230+
return schemaGeneratorDirectiveHelper.onEnum(builder.build(), schemaDirectiveParameters)
228231
}
229232

230233
private fun createInterfaceObject(interfaceDefinition: InterfaceTypeDefinition, inputObjects: List<GraphQLInputObjectType>): GraphQLInterfaceType {
@@ -240,7 +243,7 @@ class SchemaParser internal constructor(
240243
builder.field { field -> createField(field, fieldDefinition, inputObjects) }
241244
}
242245

243-
return directiveGenerator.onInterface(builder.build(), DirectiveBehavior.Params(runtimeWiring, codeRegistryBuilder))
246+
return schemaGeneratorDirectiveHelper.onInterface(builder.build(), schemaDirectiveParameters)
244247
}
245248

246249
private fun createUnionObject(definition: UnionTypeDefinition, types: List<GraphQLObjectType>): GraphQLUnionType {
@@ -253,7 +256,7 @@ class SchemaParser internal constructor(
253256
builder.withDirectives(*buildDirectives(definition.directives, setOf(), Introspection.DirectiveLocation.UNION))
254257

255258
getLeafUnionObjects(definition, types).forEach { builder.possibleType(it) }
256-
return directiveGenerator.onUnion(builder.build(), DirectiveBehavior.Params(runtimeWiring, codeRegistryBuilder))
259+
return schemaGeneratorDirectiveHelper.onUnion(builder.build(), schemaDirectiveParameters)
257260
}
258261

259262
private fun getLeafUnionObjects(definition: UnionTypeDefinition, types: List<GraphQLObjectType>): List<GraphQLObjectType> {

0 commit comments

Comments
 (0)