diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fe542364..bedc63cb 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ '8', '11', '15' ] + java: [ '11', '15', '17' ] steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 74463527..37e6052a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: - name: Setup java uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'adopt' - name: Build with Maven run: mvn --batch-mode --update-snapshots verify @@ -23,7 +23,7 @@ jobs: - name: Setup Maven Central uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'adopt' server-id: ossrh server-username: MAVEN_USERNAME diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 6ab13951..710b85cf 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -12,7 +12,7 @@ jobs: - name: Setup java uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'adopt' - name: Build with Maven run: mvn --batch-mode --update-snapshots verify @@ -26,7 +26,7 @@ jobs: - name: Setup Maven Central uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '11' distribution: 'adopt' server-id: ossrh server-username: MAVEN_USERNAME diff --git a/pom.xml b/pom.xml index feedbde4..6ba520e0 100644 --- a/pom.xml +++ b/pom.xml @@ -13,11 +13,11 @@ UTF-8 - 1.8 + 11 1.8.21 1.6.4 2.14.2 - 20.1 + 21.0 1.0.4 ${java.version} @@ -279,8 +279,8 @@ maven-compiler-plugin 3.11.0 - 1.8 - 1.8 + 11 + 11 diff --git a/src/main/kotlin/graphql/kickstart/tools/GenericType.kt b/src/main/kotlin/graphql/kickstart/tools/GenericType.kt index 35b9df7c..820ab845 100644 --- a/src/main/kotlin/graphql/kickstart/tools/GenericType.kt +++ b/src/main/kotlin/graphql/kickstart/tools/GenericType.kt @@ -83,8 +83,7 @@ internal open class GenericType(protected val mostSpecificType: JavaType, protec * Unwrap certain Java types to find the "real" class. */ fun unwrapGenericType(javaType: JavaType): JavaType { - val type = replaceTypeVariable(javaType) - return when (type) { + return when (val type = replaceTypeVariable(javaType)) { is ParameterizedType -> { val rawType = type.rawType val genericType = options.genericWrappers.find { it.type == rawType } @@ -107,7 +106,7 @@ internal open class GenericType(protected val mostSpecificType: JavaType, protec } } is WildcardType -> type.upperBounds.firstOrNull() - ?: throw error("Unable to unwrap type, wildcard has no upper bound: $type") + ?: error("Unable to unwrap type, wildcard has no upper bound: $type") is Class<*> -> if (type.isPrimitive) Primitives.wrap(type) else type else -> error("Unable to unwrap type: $type") } diff --git a/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt b/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt index fd445ff9..650cb679 100644 --- a/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt +++ b/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt @@ -174,7 +174,7 @@ internal class SchemaClassScanner( .coercing(provided.coercing) .definition(definition) .build() - }.associateBy { it.name!! } + }.associateBy { it.name } val unusedDefinitions = (definitionsByName.values - observedDefinitions).toSet() unusedDefinitions diff --git a/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt b/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt index aa9055d7..2e8365f9 100644 --- a/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt +++ b/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt @@ -4,6 +4,7 @@ import graphql.language.Definition import graphql.language.Document import graphql.parser.MultiSourceReader import graphql.parser.Parser +import graphql.parser.ParserEnvironment import graphql.parser.ParserOptions import graphql.schema.GraphQLScalarType import graphql.schema.idl.RuntimeWiring @@ -25,6 +26,10 @@ class SchemaParserBuilder { private val scalars = mutableListOf() private val runtimeWiringBuilder = RuntimeWiring.newRuntimeWiring() private var options = SchemaParserOptions.defaultOptions() + private val parser = Parser() + private val parserOptions = ParserOptions + .getDefaultParserOptions() + .transform { o -> o.maxTokens(MAX_VALUE) } /** * Add GraphQL schema files from the classpath. @@ -166,21 +171,14 @@ class SchemaParserBuilder { } private fun parseDocuments(): List { - val parser = Parser() - val documents = mutableListOf() try { - val options = ParserOptions - .getDefaultParserOptions() - .transform { o -> o.maxTokens(MAX_VALUE) } + val documents = files.map { parseDocument(readFile(it), it) }.toMutableList() - files.forEach { - val sourceReader = MultiSourceReader.newMultiSourceReader().string(readFile(it), it).trackData(true).build() - documents.add(parser.parseDocument(sourceReader, options)) + if (schemaString.isNotBlank()) { + documents.add(parseDocument(schemaString.toString())) } - if (schemaString.isNotEmpty()) { - documents.add(parser.parseDocument(schemaString.toString(), options)) - } + return documents } catch (pce: ParseCancellationException) { val cause = pce.cause if (cause != null && cause is RecognitionException) { @@ -189,23 +187,34 @@ class SchemaParserBuilder { throw pce } } - return documents } - private fun readFile(filename: String): String { - return java.io.BufferedReader(java.io.InputStreamReader( - object : Any() {}.javaClass.classLoader.getResourceAsStream(filename) - ?: throw java.io.FileNotFoundException("classpath:$filename") - )).readText() + private fun parseDocument(input: String, sourceName: String? = null): Document { + val sourceReader = MultiSourceReader + .newMultiSourceReader() + .string(input, sourceName) + .trackData(true).build() + val environment = ParserEnvironment + .newParserEnvironment() + .document(sourceReader) + .parserOptions(parserOptions).build() + return parser.parseDocument(environment) } + private fun readFile(filename: String) = + this::class.java.classLoader.getResource(filename)?.readText() + ?: throw java.io.FileNotFoundException("classpath:$filename") + /** * Build the parser with the supplied schema and dictionary. */ fun build() = SchemaParser(scan(), options, runtimeWiringBuilder.build()) } -class InvalidSchemaError(pce: ParseCancellationException, private val recognitionException: RecognitionException) : RuntimeException(pce) { - override val message: String? +class InvalidSchemaError( + pce: ParseCancellationException, + private val recognitionException: RecognitionException +) : RuntimeException(pce) { + override val message: String get() = "Invalid schema provided (${recognitionException.javaClass.name}) at: ${recognitionException.offendingToken}" } diff --git a/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt b/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt index faa1346d..4ff5e451 100644 --- a/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt +++ b/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt @@ -68,7 +68,7 @@ internal class TypeClassMatcher(private val definitionsByName: Map { if (realType is ParameterizedType && isListType(realType, potentialMatch)) { match(potentialMatch, graphQLType.type, realType.actualTypeArguments.first()) - } else if ((realType as Class<*>).isArray) { + } else if (realType is Class<*> && realType.isArray) { match(potentialMatch, graphQLType.type, realType.componentType) } else { throw error(potentialMatch, "Java class is not a List or generic type information was lost: $realType") diff --git a/src/main/kotlin/graphql/kickstart/tools/directive/SchemaDirectiveWiringEnvironmentImpl.kt b/src/main/kotlin/graphql/kickstart/tools/directive/SchemaDirectiveWiringEnvironmentImpl.kt index 143fc59d..c11e1881 100644 --- a/src/main/kotlin/graphql/kickstart/tools/directive/SchemaDirectiveWiringEnvironmentImpl.kt +++ b/src/main/kotlin/graphql/kickstart/tools/directive/SchemaDirectiveWiringEnvironmentImpl.kt @@ -56,7 +56,8 @@ class SchemaDirectiveWiringEnvironmentImpl( override fun getFieldDataFetcher(): DataFetcher<*> { checkNotNull(fieldDefinition) { "An output field must be in context to call this method" } checkNotNull(fieldsContainer) { "An output field container must be in context to call this method" } - return codeRegistry.getDataFetcher(fieldsContainer, fieldDefinition) + val coordinates = FieldCoordinates.coordinates(fieldsContainer, fieldDefinition) + return codeRegistry.getDataFetcher(coordinates, fieldDefinition) } override fun setFieldDataFetcher(newDataFetcher: DataFetcher<*>?): GraphQLFieldDefinition { diff --git a/src/test/kotlin/graphql/kickstart/tools/DirectiveTest.kt b/src/test/kotlin/graphql/kickstart/tools/DirectiveTest.kt index 03b0dd85..b7d8150f 100644 --- a/src/test/kotlin/graphql/kickstart/tools/DirectiveTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/DirectiveTest.kt @@ -4,10 +4,7 @@ import graphql.GraphQL import graphql.execution.AsyncExecutionStrategy import graphql.relay.Connection import graphql.relay.SimpleListConnection -import graphql.schema.DataFetcherFactories -import graphql.schema.DataFetchingEnvironment -import graphql.schema.GraphQLFieldDefinition -import graphql.schema.GraphQLObjectType +import graphql.schema.* import graphql.schema.idl.SchemaDirectiveWiring import graphql.schema.idl.SchemaDirectiveWiringEnvironment import org.junit.Ignore @@ -325,7 +322,7 @@ class DirectiveTest { override fun onField(environment: SchemaDirectiveWiringEnvironment): GraphQLFieldDefinition { val field = environment.element - val parentType = environment.fieldsContainer + val parentType = FieldCoordinates.coordinates(environment.fieldsContainer, environment.fieldDefinition) val originalDataFetcher = environment.codeRegistry.getDataFetcher(parentType, field) val wrappedDataFetcher = DataFetcherFactories.wrapDataFetcher(originalDataFetcher) { _, value -> @@ -342,7 +339,7 @@ class DirectiveTest { override fun onField(environment: SchemaDirectiveWiringEnvironment): GraphQLFieldDefinition { val field = environment.element - val parentType = environment.fieldsContainer + val parentType = FieldCoordinates.coordinates(environment.fieldsContainer, environment.fieldDefinition) val originalDataFetcher = environment.codeRegistry.getDataFetcher(parentType, field) val wrappedDataFetcher = DataFetcherFactories.wrapDataFetcher(originalDataFetcher) { _, value -> @@ -350,7 +347,7 @@ class DirectiveTest { string + string } - environment.codeRegistry.dataFetcher(parentType, field, wrappedDataFetcher) + environment.codeRegistry.dataFetcher(parentType, wrappedDataFetcher) return field } diff --git a/src/test/kotlin/graphql/kickstart/tools/EndToEndSpecHelper.kt b/src/test/kotlin/graphql/kickstart/tools/EndToEndSpecHelper.kt index 3b56047c..329f9ed8 100644 --- a/src/test/kotlin/graphql/kickstart/tools/EndToEndSpecHelper.kt +++ b/src/test/kotlin/graphql/kickstart/tools/EndToEndSpecHelper.kt @@ -1,8 +1,11 @@ package graphql.kickstart.tools +import graphql.GraphQLContext +import graphql.execution.CoercedVariables import graphql.execution.DataFetcherResult import graphql.language.ObjectValue import graphql.language.StringValue +import graphql.language.Value import graphql.schema.* import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.channels.Channel @@ -444,18 +447,22 @@ val customScalarId = GraphQLScalarType.newScalar() .name("ID") .description("Overrides built-in ID") .coercing(object : Coercing { - override fun serialize(input: Any): String? = when (input) { + override fun serialize(input: Any, context: GraphQLContext, locale: Locale) = when (input) { is String -> input is UUID -> input.toString() else -> null } - override fun parseValue(input: Any): UUID = parseLiteral(input) - - override fun parseLiteral(input: Any): UUID = when (input) { + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale) = when (input) { is StringValue -> UUID.fromString(input.value) else -> throw CoercingParseLiteralException() } + + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale) = + when (input) { + is StringValue -> UUID.fromString(input.value) + else -> throw CoercingParseLiteralException() + } }) .build() @@ -464,18 +471,22 @@ val customScalarUUID = GraphQLScalarType.newScalar() .description("UUID") .coercing(object : Coercing { - override fun serialize(input: Any): String? = when (input) { + override fun serialize(input: Any, context: GraphQLContext, locale: Locale): String? = when (input) { is String -> input is UUID -> input.toString() else -> null } - override fun parseValue(input: Any): UUID = parseLiteral(input) - - override fun parseLiteral(input: Any): UUID = when (input) { + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale): UUID = when (input) { is StringValue -> UUID.fromString(input.value) else -> throw CoercingParseLiteralException() } + + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale): UUID = + when (input) { + is StringValue -> UUID.fromString(input.value) + else -> throw CoercingParseLiteralException() + } }) .build() @@ -485,12 +496,19 @@ val customScalarMap = GraphQLScalarType.newScalar() .coercing(object : Coercing, Map> { @Suppress("UNCHECKED_CAST") - override fun parseValue(input: Any): Map = input as Map + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale): Map = input as Map @Suppress("UNCHECKED_CAST") - override fun serialize(dataFetcherResult: Any): Map = dataFetcherResult as Map - - override fun parseLiteral(input: Any): Map = (input as ObjectValue).objectFields.associateBy { it.name }.mapValues { (it.value.value as StringValue).value } + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale): Map = + dataFetcherResult as Map + + override fun parseLiteral( + input: Value<*>, + variables: CoercedVariables, + context: GraphQLContext, + locale: Locale + ): Map = + (input as ObjectValue).objectFields.associateBy { it.name }.mapValues { (it.value.value as StringValue).value } }) .build() @@ -499,11 +517,11 @@ val uploadScalar: GraphQLScalarType = GraphQLScalarType.newScalar() .name("Upload") .description("A file part in a multipart request") .coercing(object : Coercing { - override fun serialize(dataFetcherResult: Any): Void? { + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale): Void? { throw CoercingSerializeException("Upload is an input-only type") } - override fun parseValue(input: Any): Part { + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale): Part { return when (input) { is Part -> { input @@ -514,9 +532,8 @@ val uploadScalar: GraphQLScalarType = GraphQLScalarType.newScalar() } } - override fun parseLiteral(input: Any): Part { - throw CoercingParseLiteralException( - "Must use variables to specify Upload values") + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale): Part { + throw CoercingParseLiteralException("Must use variables to specify Upload values") } }).build() diff --git a/src/test/kotlin/graphql/kickstart/tools/FieldResolverScannerTest.kt b/src/test/kotlin/graphql/kickstart/tools/FieldResolverScannerTest.kt index f092b3b3..e5631844 100644 --- a/src/test/kotlin/graphql/kickstart/tools/FieldResolverScannerTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/FieldResolverScannerTest.kt @@ -10,9 +10,11 @@ import graphql.language.TypeName import graphql.relay.Connection import graphql.relay.DefaultConnection import graphql.relay.DefaultPageInfo +import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import java.util.* +@OptIn(ExperimentalCoroutinesApi::class) class FieldResolverScannerTest { private val options = defaultOptions() diff --git a/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt b/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt index f6701d01..481d2a4e 100644 --- a/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt @@ -3,7 +3,7 @@ package graphql.kickstart.tools import graphql.ExecutionResult import graphql.GraphQLContext import graphql.execution.* -import graphql.execution.instrumentation.SimpleInstrumentation +import graphql.execution.instrumentation.SimplePerformantInstrumentation import graphql.kickstart.tools.resolver.FieldResolverError import graphql.kickstart.tools.resolver.FieldResolverScanner import graphql.language.FieldDefinition @@ -24,6 +24,7 @@ import org.reactivestreams.tck.TestEnvironment import java.util.concurrent.CompletableFuture import kotlin.coroutines.coroutineContext +@OptIn(ExperimentalCoroutinesApi::class) class MethodFieldResolverDataFetcherTest { @Test @@ -311,7 +312,7 @@ class MethodFieldResolverDataFetcherTest { } val executionId = ExecutionId.from("executionId123") return ExecutionContextBuilder.newExecutionContextBuilder() - .instrumentation(SimpleInstrumentation.INSTANCE) + .instrumentation(SimplePerformantInstrumentation.INSTANCE) .executionId(executionId) .queryStrategy(executionStrategy) .mutationStrategy(executionStrategy) diff --git a/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverTest.kt b/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverTest.kt index 4dff5e0f..1c647da0 100644 --- a/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverTest.kt @@ -2,17 +2,22 @@ package graphql.kickstart.tools import graphql.ExecutionInput import graphql.GraphQL +import graphql.GraphQLContext +import graphql.execution.CoercedVariables import graphql.language.StringValue +import graphql.language.Value import graphql.schema.Coercing import graphql.schema.CoercingParseLiteralException import graphql.schema.CoercingSerializeException import graphql.schema.GraphQLScalarType +import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import java.lang.reflect.InvocationHandler import java.lang.reflect.Method import java.lang.reflect.Proxy import java.util.* +@OptIn(ExperimentalCoroutinesApi::class) class MethodFieldResolverTest { @Test @@ -228,14 +233,14 @@ class MethodFieldResolverTest { .description("customScalar") .coercing(object : Coercing { - override fun parseValue(input: Any) = CustomScalar.of(input) + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale) = CustomScalar.of(input) - override fun parseLiteral(input: Any): CustomScalar = when (input) { + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale): CustomScalar = when (input) { is StringValue -> CustomScalar.of(input.value) else -> throw CoercingParseLiteralException() } - override fun serialize(dataFetcherResult: Any) = when (dataFetcherResult) { + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale) = when (dataFetcherResult) { is CustomScalar -> dataFetcherResult.value else -> throw CoercingSerializeException() } diff --git a/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt b/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt index 6a416bb1..665d37b4 100644 --- a/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt @@ -6,9 +6,11 @@ import graphql.kickstart.tools.resolver.MissingResolverDataFetcherProvider import graphql.language.FieldDefinition import graphql.schema.DataFetcher import graphql.schema.DataFetchingEnvironment +import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import java.util.* +@OptIn(ExperimentalCoroutinesApi::class) class MissingFieldResolverTest { @Test(expected = FieldResolverError::class) diff --git a/src/test/kotlin/graphql/kickstart/tools/ReactiveTest.kt b/src/test/kotlin/graphql/kickstart/tools/ReactiveTest.kt index 40c08d3f..377b4639 100644 --- a/src/test/kotlin/graphql/kickstart/tools/ReactiveTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/ReactiveTest.kt @@ -4,6 +4,7 @@ import graphql.GraphQL import graphql.execution.AsyncExecutionStrategy import graphql.kickstart.tools.SchemaParser.Companion.newParser import graphql.kickstart.tools.SchemaParserOptions.Companion.newOptions +import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import java.util.* import java.util.concurrent.CompletableFuture @@ -12,6 +13,7 @@ import java.util.concurrent.Future //import io.reactivex.Single; //import io.reactivex.internal.operators.single.SingleJust; //import static io.reactivex.Maybe.just; +@OptIn(ExperimentalCoroutinesApi::class) class ReactiveTest { @Test diff --git a/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerTest.kt b/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerTest.kt index 673fbe33..9e96d925 100644 --- a/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerTest.kt @@ -1,10 +1,16 @@ package graphql.kickstart.tools +import graphql.GraphQLContext +import graphql.execution.CoercedVariables +import graphql.language.Value import graphql.schema.* +import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Ignore import org.junit.Test +import java.util.* import java.util.concurrent.CompletableFuture +@OptIn(ExperimentalCoroutinesApi::class) class SchemaClassScannerTest { @Test @@ -186,9 +192,9 @@ class SchemaClassScannerTest { .name("UUID") .description("Test scalars with duplicate types") .coercing(object : Coercing { - override fun serialize(dataFetcherResult: Any): Any? = null - override fun parseValue(input: Any): Any = input - override fun parseLiteral(input: Any): Any = input + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale): Any? = null + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale): Any = input + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale): Any = input }).build()) .schemaString( """ @@ -307,9 +313,9 @@ class SchemaClassScannerTest { val customMap = GraphQLScalarType.newScalar() .name("customMap") .coercing(object : Coercing, Map> { - override fun serialize(dataFetcherResult: Any): Map = mapOf() - override fun parseValue(input: Any): Map = mapOf() - override fun parseLiteral(input: Any): Map = mapOf() + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale): Map = mapOf() + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale): Map = mapOf() + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale): Map = mapOf() }).build() val schema = SchemaParser.newParser() diff --git a/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt b/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt index 4df062d7..50700fb7 100644 --- a/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt @@ -4,6 +4,7 @@ import graphql.kickstart.tools.resolver.FieldResolverError import graphql.schema.* import graphql.schema.idl.SchemaDirectiveWiring import graphql.schema.idl.SchemaDirectiveWiringEnvironment +import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Assert.assertThrows import org.junit.Before import org.junit.Test @@ -11,6 +12,7 @@ import org.springframework.aop.framework.ProxyFactory import java.io.FileNotFoundException import java.util.concurrent.Future +@OptIn(ExperimentalCoroutinesApi::class) class SchemaParserTest { private lateinit var builder: SchemaParserBuilder diff --git a/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt b/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt index 4fcb4b34..d30f0b33 100644 --- a/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt @@ -6,6 +6,7 @@ import graphql.kickstart.tools.resolver.FieldResolverScanner import graphql.kickstart.tools.util.ParameterizedTypeImpl import graphql.language.* import graphql.language.Type +import kotlinx.coroutines.ExperimentalCoroutinesApi import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized @@ -22,6 +23,7 @@ import java.util.concurrent.Future TypeClassMatcherTest.Suit3::class, TypeClassMatcherTest.Suit4::class ) +@OptIn(ExperimentalCoroutinesApi::class) class TypeClassMatcherTest { companion object {