Skip to content

Commit 3d313be

Browse files
author
smyrick
committed
address pr comments
1 parent 399c087 commit 3d313be

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

example/src/main/kotlin/com/expedia/graphql/sample/query/EnvironmentQuery.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ data class NestedNode(
1313
val parentValue: Int? = null
1414
) {
1515
fun nested(environment: DataFetchingEnvironment, value: Int): NestedNode {
16-
val parentValue: Int? = if (environment.executionStepInfo.hasParent()) environment.executionStepInfo.parent.getArgument("value") else null
16+
val parentValue: Int? = if (environment.executionStepInfo.hasParent()) {
17+
environment.executionStepInfo.parent.getArgument("value")
18+
} else {
19+
null
20+
}
1721

1822
return NestedNode(value, parentValue)
1923
}

src/main/kotlin/com/expedia/graphql/generator/extensions/kParameterExtensions.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import com.expedia.graphql.exceptions.CouldNotGetNameOfKParameterException
55
import graphql.schema.DataFetchingEnvironment
66
import kotlin.reflect.KParameter
77
import kotlin.reflect.full.findAnnotation
8-
import kotlin.reflect.full.isSuperclassOf
98

109
internal fun KParameter.isInterface() = this.type.getKClass().isInterface()
1110

1211
internal fun KParameter.isGraphQLContext() = this.findAnnotation<GraphQLContext>() != null
1312

14-
internal fun KParameter.isDataFetchingEnvironment() = this.type.getKClass().isSuperclassOf(DataFetchingEnvironment::class)
13+
internal fun KParameter.isDataFetchingEnvironment() = this.type.classifier == DataFetchingEnvironment::class
1514

1615
@Throws(CouldNotGetNameOfKParameterException::class)
1716
internal fun KParameter.getName(): String =

0 commit comments

Comments
 (0)