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(
6464 private var includeUnusedTypes = false
6565 private var useCommentsForDescriptions = true
6666
67- @Deprecated(" Replaced with graphql.GraphQLContext" )
6867 fun contextClass (contextClass : Class <* >) = this .apply {
6968 this .contextClass = contextClass
7069 }
7170
72- @Deprecated(" Replaced with graphql.GraphQLContext" )
7371 fun contextClass (contextClass : KClass <* >) = this .apply {
7472 this .contextClass = contextClass.java
7573 }
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ internal class MethodFieldResolver(
3333
3434 private val additionalLastArgument =
3535 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 )
3738 } catch (e: InternalError ) {
3839 method.parameterCount == (field.inputValueDefinitions.size + getIndexOffset() + 1 )
3940 }
@@ -95,7 +96,10 @@ internal class MethodFieldResolver(
9596 if (this .additionalLastArgument) {
9697 when (this .method.parameterTypes.last()) {
9798 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+ }
99103 GraphQLContext ::class .java -> args.add { environment -> environment.graphQlContext }
100104 else -> args.add { environment -> environment }
101105 }
You can’t perform that action at this time.
0 commit comments