Skip to content

Commit d0ee10a

Browse files
authored
Merge pull request #612 from graphql-java-kickstart/577-split-package
577 remove usage of protected method in SchemaGeneratorHelper
2 parents 33b9ead + 496b3fc commit d0ee10a

File tree

3 files changed

+9
-29
lines changed

3 files changed

+9
-29
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import graphql.language.*
1010
import graphql.schema.*
1111
import graphql.schema.idl.RuntimeWiring
1212
import graphql.schema.idl.ScalarInfo
13-
import graphql.schema.idl.SchemaGeneratorHelperExt
1413
import graphql.schema.visibility.NoIntrospectionGraphqlFieldVisibility
1514
import org.slf4j.LoggerFactory
1615
import kotlin.reflect.KClass
@@ -58,7 +57,6 @@ class SchemaParser internal constructor(
5857

5958
private val codeRegistryBuilder = GraphQLCodeRegistry.newCodeRegistry()
6059

61-
private val schemaGeneratorHelper = SchemaGeneratorHelperExt()
6260
private val schemaGeneratorDirectiveHelper = SchemaGeneratorDirectiveHelper()
6361
private val schemaDirectiveParameters = SchemaGeneratorDirectiveHelper.Parameters(null, runtimeWiring, null, codeRegistryBuilder)
6462

@@ -307,18 +305,21 @@ class SchemaParser internal constructor(
307305
names.add(directive.name)
308306
val graphQLDirective = GraphQLDirective.newDirective()
309307
.name(directive.name)
308+
.description(getDocumentation(directive, options))
309+
.comparatorRegistry(runtimeWiring.comparatorRegistry)
310+
.validLocation(directiveLocation)
310311
.apply {
311312
directive.arguments.forEach { arg ->
312313
argument(GraphQLArgument.newArgument()
313314
.name(arg.name)
314315
.type(buildDirectiveInputType(arg.value))
316+
.valueLiteral(arg.value)
315317
.build())
316318
}
317319
}
318320
.build()
319321

320-
321-
output.add(schemaGeneratorHelper.buildAppliedDirective(directive, graphQLDirective, directiveLocation, runtimeWiring.comparatorRegistry))
322+
output.add(graphQLDirective)
322323
}
323324
}
324325

@@ -392,12 +393,12 @@ class SchemaParser internal constructor(
392393
}
393394

394395
private fun determineInputType(typeDefinition: Type<*>, inputObjects: List<GraphQLInputObjectType>, referencingInputObjects: Set<String>) =
395-
determineInputType(GraphQLInputType::class, typeDefinition, permittedTypesForInputObject, inputObjects, referencingInputObjects) as GraphQLInputType
396+
determineInputType(GraphQLInputType::class, typeDefinition, permittedTypesForInputObject, inputObjects, referencingInputObjects)
396397

397398
private fun <T : Any> determineInputType(expectedType: KClass<T>,
398399
typeDefinition: Type<*>, allowedTypeReferences: Set<String>,
399400
inputObjects: List<GraphQLInputObjectType>,
400-
referencingInputObjects: Set<String>): GraphQLType =
401+
referencingInputObjects: Set<String>): GraphQLInputType =
401402
when (typeDefinition) {
402403
is ListType -> GraphQLList(determineType(expectedType, typeDefinition.type, allowedTypeReferences, inputObjects))
403404
is NonNullType -> GraphQLNonNull(determineType(expectedType, typeDefinition.type, allowedTypeReferences, inputObjects))

src/main/kotlin/graphql/kickstart/tools/util/Utils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ internal val Class<*>.declaredNonProxyMethods: List<JavaMethod>
5050
}
5151
}
5252

53-
internal fun getDocumentation(node: AbstractDescribedNode<*>, options: SchemaParserOptions): String? =
53+
internal fun getDocumentation(node: AbstractNode<*>, options: SchemaParserOptions): String? =
5454
when {
55-
node.description != null -> node.description.content
55+
node is AbstractDescribedNode<*> && node.description != null -> node.description.content
5656
!options.useCommentsForDescriptions -> null
5757
node.comments.isNullOrEmpty() -> null
5858
else -> node.comments.asSequence()

src/main/kotlin/graphql/schema/idl/SchemaGeneratorHelperExt.kt

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

0 commit comments

Comments
 (0)