fun jsonSubTypesAnnotation()

in graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin/KotlinPoetUtils.kt [100:121]


fun jsonSubTypesAnnotation(subTypes: Collection<ClassName>): AnnotationSpec {
    val subTypeAnnotations =
        subTypes.map { type ->
            AnnotationSpec
                .builder(JsonSubTypes.Type::class)
                .addMember("value = %T::class", type)
                .addMember("name = %S", type.simpleName)
                .build()
        }

    val formatString =
        subTypes.joinToString(
            separator = ",\n",
            prefix = "value = [\n⇥",
            postfix = "⇤\n]",
        ) { "%L" }

    return AnnotationSpec
        .builder(JsonSubTypes::class)
        .addMember(formatString, *subTypeAnnotations.toTypedArray())
        .build()
}