File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
src/main/kotlin/graphql/kickstart/tools Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,10 @@ data class SchemaParserOptions internal constructor(
64
64
private var includeUnusedTypes = false
65
65
private var useCommentsForDescriptions = true
66
66
67
- @Deprecated(" Replaced with graphql.GraphQLContext" )
68
67
fun contextClass (contextClass : Class <* >) = this .apply {
69
68
this .contextClass = contextClass
70
69
}
71
70
72
- @Deprecated(" Replaced with graphql.GraphQLContext" )
73
71
fun contextClass (contextClass : KClass <* >) = this .apply {
74
72
this .contextClass = contextClass.java
75
73
}
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ internal class MethodFieldResolver(
33
33
34
34
private val additionalLastArgument =
35
35
try {
36
- method.kotlinFunction?.valueParameters?.size ? : method.parameterCount == (field.inputValueDefinitions.size + getIndexOffset() + 1 )
36
+ (method.kotlinFunction?.valueParameters?.size
37
+ ? : method.parameterCount) == (field.inputValueDefinitions.size + getIndexOffset() + 1 )
37
38
} catch (e: InternalError ) {
38
39
method.parameterCount == (field.inputValueDefinitions.size + getIndexOffset() + 1 )
39
40
}
@@ -95,7 +96,10 @@ internal class MethodFieldResolver(
95
96
if (this .additionalLastArgument) {
96
97
when (this .method.parameterTypes.last()) {
97
98
null -> throw ResolverError (" Expected at least one argument but got none, this is most likely a bug with graphql-java-tools" )
98
- options.contextClass -> args.add { environment -> environment.getContext() }
99
+ options.contextClass -> args.add { environment ->
100
+ environment.graphQlContext[options.contextClass]
101
+ ? : environment.getContext() // TODO: remove deprecated use in next major release
102
+ }
99
103
GraphQLContext ::class .java -> args.add { environment -> environment.graphQlContext }
100
104
else -> args.add { environment -> environment }
101
105
}
You can’t perform that action at this time.
0 commit comments