Skip to content

Commit cc1c058

Browse files
authored
Relax type checking (#24)
* relax type checking * update api dump
1 parent 2ff2323 commit cc1c058

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

apollo-execution-processor/src/main/kotlin/com/apollographql/execution/processor/scalars.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ internal fun KSAnnotated.getCoercing(logger: KSPLogger): SirCoercing? {
2727
return null
2828
}
2929

30+
val isCoercing = declaration.superTypes.any {
31+
it.resolve().declaration.asClassName().asString() == "com.apollographql.execution.Coercing"
32+
}
33+
if (!isCoercing) {
34+
logger.error("Coercing must implement 'com.apollographql.execution.Coercing'", declaration)
35+
return null
36+
}
37+
3038
val instantiation = declaration.instantiation()
3139
if (instantiation == Instantiation.UNKNOWN) {
3240
logger.error("Coercing implementation must either be objects or have a no-arg constructor", declaration)

apollo-execution-runtime/api/apollo-execution-runtime.klib.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ open annotation class com.apollographql.execution.annotation/GraphQLQuery : kotl
238238
constructor <init>() // com.apollographql.execution.annotation/GraphQLQuery.<init>|<init>(){}[0]
239239
}
240240
open annotation class com.apollographql.execution.annotation/GraphQLScalar : kotlin/Annotation { // com.apollographql.execution.annotation/GraphQLScalar|null[0]
241-
constructor <init>(kotlin.reflect/KClass<out com.apollographql.execution/Coercing<*>>) // com.apollographql.execution.annotation/GraphQLScalar.<init>|<init>(kotlin.reflect.KClass<out|com.apollographql.execution.Coercing<*>>){}[0]
241+
constructor <init>(kotlin.reflect/KClass<*>) // com.apollographql.execution.annotation/GraphQLScalar.<init>|<init>(kotlin.reflect.KClass<*>){}[0]
242242
final val coercing // com.apollographql.execution.annotation/GraphQLScalar.coercing|{}coercing[0]
243-
final fun <get-coercing>(): kotlin.reflect/KClass<out com.apollographql.execution/Coercing<*>> // com.apollographql.execution.annotation/GraphQLScalar.coercing.<get-coercing>|<get-coercing>(){}[0]
243+
final fun <get-coercing>(): kotlin.reflect/KClass<*> // com.apollographql.execution.annotation/GraphQLScalar.coercing.<get-coercing>|<get-coercing>(){}[0]
244244
}
245245
open annotation class com.apollographql.execution.annotation/GraphQLSubscription : kotlin/Annotation { // com.apollographql.execution.annotation/GraphQLSubscription|null[0]
246246
constructor <init>() // com.apollographql.execution.annotation/GraphQLSubscription.<init>|<init>(){}[0]

apollo-execution-runtime/src/commonMain/kotlin/com/apollographql/execution/annotation/GraphQLScalar.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ import kotlin.reflect.KClass
2222
* When using type aliases, you may use either the alias or the original type.
2323
*/
2424
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS)
25-
annotation class GraphQLScalar(val coercing: KClass<out Coercing<*>>)
25+
annotation class GraphQLScalar(val coercing: KClass<*>)

0 commit comments

Comments
 (0)