Skip to content

Commit 5b058bf

Browse files
samuelAndalonbherrmann2samvazquez
authored
feat: support directives with union (#1439)
* feat: support directives with the union annotation (#1424) * feat: support directives with the union annotation * CR comment * fix: willAddGraphQLTypeToSchema needs annotations from field (#1437) * feat: use withDirective * feat: update tests Co-authored-by: bherrmann2 <[email protected]> Co-authored-by: samvazquez <[email protected]>
1 parent 8fbec9d commit 5b058bf

File tree

14 files changed

+332
-21
lines changed

14 files changed

+332
-21
lines changed

generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/SchemaGenerator.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.expediagroup.graphql.generator
1818

1919
import com.expediagroup.graphql.generator.exceptions.InvalidPackagesException
20+
import com.expediagroup.graphql.generator.internal.extensions.getKClass
2021
import com.expediagroup.graphql.generator.internal.state.AdditionalType
2122
import com.expediagroup.graphql.generator.internal.state.ClassScanner
2223
import com.expediagroup.graphql.generator.internal.state.TypesCache
@@ -121,7 +122,7 @@ open class SchemaGenerator(internal val config: SchemaGeneratorConfig) : Closeab
121122
this.additionalTypes.clear()
122123
graphqlTypes.addAll(
123124
currentlyProcessedTypes.map {
124-
GraphQLTypeUtil.unwrapNonNull(generateGraphQLType(this, it.kType, GraphQLKTypeMetadata(inputType = it.inputType)))
125+
GraphQLTypeUtil.unwrapNonNull(generateGraphQLType(this, it.kType, GraphQLKTypeMetadata(inputType = it.inputType, fieldAnnotations = it.kType.getKClass().annotations)))
125126
}
126127
)
127128
}

generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/annotations/GraphQLUnion.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package com.expediagroup.graphql.generator.annotations
1818

1919
import kotlin.reflect.KClass
2020

21-
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
21+
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.ANNOTATION_CLASS)
2222
annotation class GraphQLUnion(
2323
val name: String,
2424
val possibleTypes: Array<KClass<*>>,

generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/internal/extensions/annotationExtensions.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.expediagroup.graphql.generator.annotations.GraphQLName
2222
import com.expediagroup.graphql.generator.annotations.GraphQLType
2323
import com.expediagroup.graphql.generator.annotations.GraphQLUnion
2424
import kotlin.reflect.KAnnotatedElement
25+
import kotlin.reflect.KClass
2526
import kotlin.reflect.full.findAnnotation
2627

2728
internal fun KAnnotatedElement.getGraphQLDescription(): String? = this.findAnnotation<GraphQLDescription>()?.value
@@ -32,7 +33,11 @@ internal fun KAnnotatedElement.getDeprecationReason(): String? = this.findAnnota
3233

3334
internal fun KAnnotatedElement.isGraphQLIgnored(): Boolean = this.findAnnotation<GraphQLIgnore>() != null
3435

35-
internal fun List<Annotation>.getUnionAnnotation(): GraphQLUnion? = this.filterIsInstance(GraphQLUnion::class.java).firstOrNull()
36+
internal fun List<Annotation>.getUnionAnnotation(): GraphQLUnion? = this.filterIsInstance(GraphQLUnion::class.java).firstOrNull() ?: this.map { it.getMetaUnionAnnotation() }.firstOrNull()
37+
38+
internal fun List<Annotation>.getCustomUnionClassWithMetaUnionAnnotation(): KClass<*>? = this.firstOrNull { it.getMetaUnionAnnotation() != null }?.annotationClass
39+
40+
internal fun Annotation.getMetaUnionAnnotation(): GraphQLUnion? = this.annotationClass.annotations.filterIsInstance(GraphQLUnion::class.java).firstOrNull()
3641

3742
internal fun List<Annotation>.getCustomTypeAnnotation(): GraphQLType? = this.filterIsInstance(GraphQLType::class.java).firstOrNull()
3843

generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/internal/extensions/kClassExtensions.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ internal fun KClass<*>.isUnion(fieldAnnotations: List<Annotation> = emptyList())
6464

6565
private fun KClass<*>.isDeclaredUnion() = this.isInterface() && this.declaredMemberProperties.isEmpty() && this.declaredMemberFunctions.isEmpty()
6666

67-
internal fun KClass<*>.isAnnotationUnion(fieldAnnotations: List<Annotation>): Boolean = this.isInstance(Any::class) && fieldAnnotations.getUnionAnnotation() != null
67+
internal fun KClass<*>.isAnnotationUnion(fieldAnnotations: List<Annotation>): Boolean = (this.isInstance(Any::class) || this.isAnnotation()) &&
68+
fieldAnnotations.getUnionAnnotation() != null
69+
70+
internal fun KClass<*>.isAnnotation(): Boolean = this.isSubclassOf(Annotation::class)
6871

6972
/**
7073
* Do not add interfaces as additional types if it expects all the types

generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/internal/state/TypesCache.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import graphql.schema.GraphQLTypeReference
3434
import java.io.Closeable
3535
import kotlin.reflect.KClass
3636
import kotlin.reflect.KType
37+
import kotlin.reflect.full.createType
3738
import kotlin.reflect.full.isSubclassOf
3839
import kotlin.reflect.full.starProjectedType
3940

@@ -88,7 +89,7 @@ internal class TypesCache(private val supportedPackages: List<String>) : Closeab
8889
val unionAnnotation = typeInfo.fieldAnnotations.getUnionAnnotation()
8990
if (unionAnnotation != null) {
9091
if (type.getKClass().isAnnotationUnion(typeInfo.fieldAnnotations)) {
91-
return TypesCacheKey(type, typeInfo.inputType, getCustomUnionNameKey(unionAnnotation))
92+
return TypesCacheKey(Any::class.createType(), typeInfo.inputType, getCustomUnionNameKey(unionAnnotation))
9293
} else {
9394
throw InvalidCustomUnionException(type)
9495
}
@@ -148,7 +149,8 @@ internal class TypesCache(private val supportedPackages: List<String>) : Closeab
148149
typesUnderConstruction.add(cacheKey)
149150
val newType = build(kClass)
150151
if (newType !is GraphQLTypeReference && newType is GraphQLNamedType) {
151-
put(cacheKey, KGraphQLType(kClass, newType))
152+
val cacheKClass = if (kClass.isAnnotationUnion(typeInfo.fieldAnnotations)) Any::class else kClass
153+
put(cacheKey, KGraphQLType(cacheKClass, newType))
152154
}
153155
typesUnderConstruction.remove(cacheKey)
154156
newType

generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/internal/types/generateGraphQLType.kt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ package com.expediagroup.graphql.generator.internal.types
1919
import com.expediagroup.graphql.generator.SchemaGenerator
2020
import com.expediagroup.graphql.generator.extensions.unwrapType
2121
import com.expediagroup.graphql.generator.internal.extensions.getCustomTypeAnnotation
22+
import com.expediagroup.graphql.generator.internal.extensions.getCustomUnionClassWithMetaUnionAnnotation
2223
import com.expediagroup.graphql.generator.internal.extensions.getKClass
24+
import com.expediagroup.graphql.generator.internal.extensions.getMetaUnionAnnotation
2325
import com.expediagroup.graphql.generator.internal.extensions.getUnionAnnotation
26+
import com.expediagroup.graphql.generator.internal.extensions.isAnnotation
2427
import com.expediagroup.graphql.generator.internal.extensions.isEnum
2528
import com.expediagroup.graphql.generator.internal.extensions.isInterface
2629
import com.expediagroup.graphql.generator.internal.extensions.isListType
@@ -30,6 +33,7 @@ import graphql.schema.GraphQLType
3033
import graphql.schema.GraphQLTypeReference
3134
import kotlin.reflect.KClass
3235
import kotlin.reflect.KType
36+
import kotlin.reflect.full.createType
3337

3438
/**
3539
* Return a basic GraphQL type given all the information about the kotlin type.
@@ -61,7 +65,19 @@ private fun objectFromReflection(generator: SchemaGenerator, type: KType, typeIn
6165

6266
return generator.cache.buildIfNotUnderConstruction(kClass, typeInfo) {
6367
val graphQLType = getGraphQLType(generator, kClass, type, typeInfo)
64-
generator.config.hooks.willAddGraphQLTypeToSchema(type, graphQLType)
68+
69+
/*
70+
* For a field using the meta union annotation, the `type` is `Any`, but we need to pass the annotation with the meta union annotation as the type
71+
* since that is really the type generated from reflection and has any potential directives on it needed by the hook
72+
*/
73+
val metaUnion = typeInfo.fieldAnnotations.firstOrNull { it.getMetaUnionAnnotation() != null }
74+
val resolvedType = if (kClass.isInstance(Any::class) && metaUnion != null) {
75+
metaUnion.annotationClass.createType()
76+
} else {
77+
type
78+
}
79+
80+
generator.config.hooks.willAddGraphQLTypeToSchema(resolvedType, graphQLType)
6581
}
6682
}
6783

@@ -79,7 +95,12 @@ private fun getGraphQLType(
7995
return when {
8096
kClass.isEnum() -> @Suppress("UNCHECKED_CAST") (generateEnum(generator, kClass as KClass<Enum<*>>))
8197
kClass.isListType() -> generateList(generator, type, typeInfo)
82-
kClass.isUnion(typeInfo.fieldAnnotations) -> generateUnion(generator, kClass, typeInfo.fieldAnnotations.getUnionAnnotation())
98+
kClass.isUnion(typeInfo.fieldAnnotations) -> generateUnion(
99+
generator,
100+
kClass,
101+
typeInfo.fieldAnnotations.getUnionAnnotation(),
102+
if (kClass.isAnnotation()) kClass else typeInfo.fieldAnnotations.getCustomUnionClassWithMetaUnionAnnotation()
103+
)
83104
kClass.isInterface() -> generateInterface(generator, kClass)
84105
typeInfo.inputType -> generateInputObject(generator, kClass)
85106
else -> generateObject(generator, kClass)

generator/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/generator/internal/types/generateUnion.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,28 @@ import graphql.schema.GraphQLUnionType
3232
import kotlin.reflect.KClass
3333
import kotlin.reflect.full.createType
3434

35-
internal fun generateUnion(generator: SchemaGenerator, kClass: KClass<*>, unionAnnotation: GraphQLUnion? = null): GraphQLUnionType {
35+
internal fun generateUnion(generator: SchemaGenerator, kClass: KClass<*>, unionAnnotation: GraphQLUnion? = null, customUnionAnnotationClass: KClass<*>? = null): GraphQLUnionType {
3636
return if (unionAnnotation != null) {
37-
generateUnionFromAnnotation(generator, unionAnnotation, kClass)
37+
generateUnionFromAnnotation(generator, unionAnnotation, kClass, customUnionAnnotationClass)
3838
} else {
3939
generateUnionFromKClass(generator, kClass)
4040
}
4141
}
4242

43-
private fun generateUnionFromAnnotation(generator: SchemaGenerator, unionAnnotation: GraphQLUnion, kClass: KClass<*>): GraphQLUnionType {
43+
private fun generateUnionFromAnnotation(generator: SchemaGenerator, unionAnnotation: GraphQLUnion, kClass: KClass<*>, customUnionAnnotationClass: KClass<*>?): GraphQLUnionType {
4444
val unionName = unionAnnotation.name
4545
validateGraphQLName(unionName, kClass)
4646

4747
val builder = GraphQLUnionType.newUnionType()
4848
builder.name(unionName)
4949
builder.description(unionAnnotation.description)
5050

51+
customUnionAnnotationClass?.let {
52+
generateDirectives(generator, customUnionAnnotationClass, DirectiveLocation.UNION).forEach {
53+
builder.withDirective(it)
54+
}
55+
}
56+
5157
val possibleTypes = unionAnnotation.possibleTypes.toList()
5258

5359
return createUnion(unionName, generator, builder, possibleTypes)

generator/graphql-kotlin-schema-generator/src/test/kotlin/com/expediagroup/graphql/generator/hooks/SchemaGeneratorHooksTest.kt

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ import com.expediagroup.graphql.generator.SchemaGenerator
2020
import com.expediagroup.graphql.generator.SchemaGeneratorConfig
2121
import com.expediagroup.graphql.generator.TopLevelObject
2222
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
23+
import com.expediagroup.graphql.generator.annotations.GraphQLUnion
2324
import com.expediagroup.graphql.generator.exceptions.EmptyInputObjectTypeException
2425
import com.expediagroup.graphql.generator.exceptions.EmptyInterfaceTypeException
2526
import com.expediagroup.graphql.generator.exceptions.EmptyObjectTypeException
2627
import com.expediagroup.graphql.generator.extensions.deepName
2728
import com.expediagroup.graphql.generator.getTestSchemaConfigWithHooks
29+
import com.expediagroup.graphql.generator.internal.extensions.getKClass
2830
import com.expediagroup.graphql.generator.internal.extensions.getSimpleName
2931
import com.expediagroup.graphql.generator.test.utils.graphqlUUIDType
3032
import com.expediagroup.graphql.generator.testSchemaConfig
@@ -36,6 +38,7 @@ import graphql.schema.GraphQLObjectType
3638
import graphql.schema.GraphQLScalarType
3739
import graphql.schema.GraphQLSchema
3840
import graphql.schema.GraphQLType
41+
import graphql.schema.GraphQLUnionType
3942
import graphql.schema.validation.InvalidSchemaException
4043
import kotlinx.coroutines.flow.flowOf
4144
import kotlinx.coroutines.reactive.asPublisher
@@ -221,19 +224,25 @@ class SchemaGeneratorHooksTest {
221224
override fun willAddGraphQLTypeToSchema(type: KType, generatedType: GraphQLType): GraphQLType {
222225
hookCalled = true
223226
return when {
224-
generatedType is GraphQLObjectType && generatedType.name == "SomeData" -> GraphQLObjectType.newObject(generatedType).description("My custom description").build()
225-
generatedType is GraphQLInterfaceType && generatedType.name == "RandomData" ->
227+
generatedType is GraphQLObjectType && generatedType.name == "SomeData" && type.getKClass() == SomeData::class ->
228+
GraphQLObjectType.newObject(generatedType).description("My custom description").build()
229+
generatedType is GraphQLInterfaceType && generatedType.name == "RandomData" && type.getKClass() == RandomData::class ->
226230
GraphQLInterfaceType.newInterface(generatedType).description("My custom interface description").build()
231+
generatedType is GraphQLUnionType && generatedType.name == "MyMetaUnion" && type.getKClass() == MyMetaUnion::class ->
232+
GraphQLUnionType.newUnionType(generatedType).description("My meta union description").build()
233+
generatedType is GraphQLUnionType && generatedType.name == "MyAdditionalMetaUnion" && type.getKClass() == MyAdditionalMetaUnion::class ->
234+
GraphQLUnionType.newUnionType(generatedType).description("My additional meta union description").build()
227235
else -> generatedType
228236
}
229237
}
230238
}
231239

232240
val hooks = MockSchemaGeneratorHooks()
233-
val schema = toSchema(
234-
queries = listOf(TopLevelObject(TestQuery())),
235-
config = getTestSchemaConfigWithHooks(hooks)
236-
)
241+
val generator = SchemaGenerator(getTestSchemaConfigWithHooks(hooks))
242+
val schema = generator.use {
243+
it.generateSchema(queries = listOf(TopLevelObject(TestQuery())), additionalTypes = setOf(MyAdditionalMetaUnion::class.createType()))
244+
}
245+
237246
assertTrue(hooks.hookCalled)
238247

239248
val type = schema.getObjectType("SomeData")
@@ -243,6 +252,14 @@ class SchemaGeneratorHooksTest {
243252
val interfaceType = schema.getType("RandomData") as? GraphQLInterfaceType
244253
assertNotNull(interfaceType)
245254
assertEquals(expected = "My custom interface description", actual = interfaceType.description)
255+
256+
val metaUnionType = schema.getType("MyMetaUnion") as? GraphQLUnionType
257+
assertNotNull(metaUnionType)
258+
assertEquals(expected = "My meta union description", actual = metaUnionType.description)
259+
260+
val additionalMetaUnionType = schema.getType("MyAdditionalMetaUnion") as? GraphQLUnionType
261+
assertNotNull(additionalMetaUnionType)
262+
assertEquals(expected = "My additional meta union description", actual = additionalMetaUnionType.description)
246263
}
247264

248265
@Test
@@ -346,8 +363,16 @@ class SchemaGeneratorHooksTest {
346363

347364
class TestQuery {
348365
fun query(): SomeData = SomeData("someData", 0)
366+
@MyMetaUnion
367+
fun unionQuery(): Any = SomeData("someData", 0)
349368
}
350369

370+
@GraphQLUnion(name = "MyMetaUnion", possibleTypes = [SomeData::class])
371+
annotation class MyMetaUnion
372+
373+
@GraphQLUnion(name = "MyAdditionalMetaUnion", possibleTypes = [SomeData::class])
374+
annotation class MyAdditionalMetaUnion
375+
351376
class TestSubscription {
352377
fun subscription(): Publisher<SomeData> = flowOf(SomeData("someData", 0)).asPublisher()
353378
}

generator/graphql-kotlin-schema-generator/src/test/kotlin/com/expediagroup/graphql/generator/internal/extensions/AnnotationExtensionsTest.kt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ package com.expediagroup.graphql.generator.internal.extensions
1919
import com.expediagroup.graphql.generator.annotations.GraphQLDescription
2020
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
2121
import com.expediagroup.graphql.generator.annotations.GraphQLName
22+
import com.expediagroup.graphql.generator.annotations.GraphQLUnion
2223
import org.junit.jupiter.api.Test
2324
import kotlin.reflect.KClass
2425
import kotlin.reflect.full.declaredMemberProperties
2526
import kotlin.test.assertEquals
2627
import kotlin.test.assertFalse
28+
import kotlin.test.assertNotNull
2729
import kotlin.test.assertNull
2830
import kotlin.test.assertTrue
2931

@@ -38,11 +40,20 @@ class AnnotationExtensionsTest {
3840
@property:Deprecated("property deprecated")
3941
@property:GraphQLDescription("property description")
4042
@property:GraphQLName("newName")
41-
val id: String
43+
val id: String,
44+
45+
@GraphQLUnion(name = "CustomUnion", possibleTypes = [NoAnnotations::class])
46+
val union: Any,
47+
48+
@property:MetaUnion
49+
val metaUnion: Any
4250
)
4351

4452
private data class NoAnnotations(val id: String)
4553

54+
@GraphQLUnion(name = "MetaUnion", possibleTypes = [NoAnnotations::class])
55+
annotation class MetaUnion
56+
4657
@Test
4758
fun `verify @GraphQLName on classes`() {
4859
@Suppress("DEPRECATION")
@@ -85,5 +96,25 @@ class AnnotationExtensionsTest {
8596
assertFalse(NoAnnotations::class.isGraphQLIgnored())
8697
}
8798

99+
@Test
100+
fun `verify @GraphQLUnion`() {
101+
@Suppress("DEPRECATION")
102+
assertNotNull(WithAnnotations::class.findMemberProperty("union")?.annotations?.getUnionAnnotation())
103+
@Suppress("DEPRECATION")
104+
assertNull(WithAnnotations::class.findMemberProperty("union")?.annotations?.getCustomUnionClassWithMetaUnionAnnotation())
105+
@Suppress("DEPRECATION")
106+
assertNotNull(WithAnnotations::class.findMemberProperty("metaUnion")?.annotations?.getUnionAnnotation())
107+
@Suppress("DEPRECATION")
108+
assertNotNull(WithAnnotations::class.findMemberProperty("metaUnion")?.annotations?.getCustomUnionClassWithMetaUnionAnnotation())
109+
@Suppress("DEPRECATION")
110+
assertNull(WithAnnotations::class.findMemberProperty("id")?.annotations?.getUnionAnnotation())
111+
@Suppress("DEPRECATION")
112+
assertNull(WithAnnotations::class.findMemberProperty("id")?.annotations?.getCustomUnionClassWithMetaUnionAnnotation())
113+
@Suppress("DEPRECATION")
114+
assertNotNull(WithAnnotations::class.findMemberProperty("metaUnion")?.annotations?.firstOrNull { it is MetaUnion }?.getMetaUnionAnnotation())
115+
@Suppress("DEPRECATION")
116+
assertNull(WithAnnotations::class.findMemberProperty("union")?.annotations?.firstOrNull { it is GraphQLUnion }?.getMetaUnionAnnotation())
117+
}
118+
88119
private fun KClass<*>.findMemberProperty(name: String) = this.declaredMemberProperties.find { it.name == name }
89120
}

generator/graphql-kotlin-schema-generator/src/test/kotlin/com/expediagroup/graphql/generator/internal/extensions/KClassExtensionsTest.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,17 @@ open class KClassExtensionsTest {
157157

158158
@GraphQLUnion(name = "InvalidUnion", possibleTypes = [One::class, Two::class])
159159
fun invalidCustomUnion(): Int = 1
160+
161+
@MetaUnion
162+
fun customMetaUnion(): Any = One("1")
163+
164+
@MetaUnion
165+
fun invalidCustomMetaUnion(): Int = 1
160166
}
161167

168+
@GraphQLUnion(name = "MetaUnion", possibleTypes = [One::class, Two::class])
169+
annotation class MetaUnion
170+
162171
private class FilterHooks : SchemaGeneratorHooks {
163172
override fun isValidProperty(kClass: KClass<*>, property: KProperty<*>) =
164173
property.name.contains("filteredProperty").not()
@@ -285,11 +294,23 @@ open class KClassExtensionsTest {
285294
assertTrue(TestUnion::class.isUnion())
286295
val customAnnotationUnion = TestQuery::customUnion
287296
assertTrue(customAnnotationUnion.returnType.getKClass().isUnion(customAnnotationUnion.annotations))
297+
val metaAnnotationUnion = TestQuery::customMetaUnion
298+
assertTrue(metaAnnotationUnion.returnType.getKClass().isUnion(metaAnnotationUnion.annotations))
299+
val metaUnionAnnotationClass = MetaUnion::class
300+
assertTrue(metaUnionAnnotationClass.isUnion(metaAnnotationUnion.annotations))
288301
assertFalse(InvalidPropertyUnionInterface::class.isUnion())
289302
assertFalse(InvalidFunctionUnionInterface::class.isUnion())
290303
assertFalse(Pet::class.isUnion())
291304
val invalidAnnotationUnion = TestQuery::invalidCustomUnion
292305
assertFalse(invalidAnnotationUnion.returnType.getKClass().isUnion(invalidAnnotationUnion.annotations))
306+
val invalidMetaAnnotationUnion = TestQuery::invalidCustomMetaUnion
307+
assertFalse(invalidMetaAnnotationUnion.returnType.getKClass().isUnion(invalidMetaAnnotationUnion.annotations))
308+
}
309+
310+
@Test
311+
fun `test isAnnotation extension`() {
312+
assertTrue(MetaUnion::class.isAnnotation())
313+
assertFalse(TestUnion::class.isAnnotation())
293314
}
294315

295316
@Test

0 commit comments

Comments
 (0)