Skip to content

Commit b43adc9

Browse files
committed
Fix formatting, add comment
1 parent a6393e0 commit b43adc9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ class SchemaParser internal constructor(
173173
return output.toTypedArray()
174174
}
175175

176-
private fun createInputObject(definition: InputObjectTypeDefinition, inputObjects: List<GraphQLInputObjectType>,
177-
referencingInputObjects: MutableSet<String>): GraphQLInputObjectType {
176+
private fun createInputObject(definition: InputObjectTypeDefinition, inputObjects: List<GraphQLInputObjectType>, referencingInputObjects: MutableSet<String>): GraphQLInputObjectType {
178177
val extensionDefinitions = inputExtensionDefinitions.filter { it.name == definition.name }
179178

180179
val builder = GraphQLInputObjectType.newInputObject()
@@ -352,10 +351,7 @@ class SchemaParser internal constructor(
352351
private fun determineInputType(typeDefinition: Type<*>, inputObjects: List<GraphQLInputObjectType>, referencingInputObjects: Set<String>) =
353352
determineInputType(GraphQLInputType::class, typeDefinition, permittedTypesForInputObject, inputObjects, referencingInputObjects) as GraphQLInputType
354353

355-
private fun <T : Any> determineInputType(expectedType: KClass<T>,
356-
typeDefinition: Type<*>, allowedTypeReferences: Set<String>,
357-
inputObjects: List<GraphQLInputObjectType>,
358-
referencingInputObjects: Set<String>): GraphQLType =
354+
private fun <T : Any> determineInputType(expectedType: KClass<T>, typeDefinition: Type<*>, allowedTypeReferences: Set<String>, inputObjects: List<GraphQLInputObjectType>, referencingInputObjects: Set<String>): GraphQLType =
359355
when (typeDefinition) {
360356
is ListType -> GraphQLList(determineType(expectedType, typeDefinition.type, allowedTypeReferences, inputObjects))
361357
is NonNullType -> GraphQLNonNull(determineType(expectedType, typeDefinition.type, allowedTypeReferences, inputObjects))
@@ -381,6 +377,7 @@ class SchemaParser internal constructor(
381377
if (filteredDefinitions.isNotEmpty()) {
382378
val referencingInputObject = referencingInputObjects.find { it == typeDefinition.name }
383379
if (referencingInputObject != null) {
380+
// avoid creating another input object if it already exists to prevent infinite recursion
384381
GraphQLTypeReference(referencingInputObject)
385382
} else {
386383
val inputObject = createInputObject(filteredDefinitions[0], inputObjects, referencingInputObjects as MutableSet<String>)

0 commit comments

Comments
 (0)