diff --git a/kotlin-runtime/ftl-runtime/src/main/kotlin/xyz/block/ftl/schemaextractor/ExtractSchemaRule.kt b/kotlin-runtime/ftl-runtime/src/main/kotlin/xyz/block/ftl/schemaextractor/ExtractSchemaRule.kt index 2d89ff7654..113c854120 100644 --- a/kotlin-runtime/ftl-runtime/src/main/kotlin/xyz/block/ftl/schemaextractor/ExtractSchemaRule.kt +++ b/kotlin-runtime/ftl-runtime/src/main/kotlin/xyz/block/ftl/schemaextractor/ExtractSchemaRule.kt @@ -142,9 +142,11 @@ class SchemaExtractor( } // Validate return type - val respClass = verb.createTypeBindingForReturnType(bindingContext)?.type?.toClassDescriptor() + val respClass = verb.createTypeBindingForReturnType(bindingContext)?.type ?: throw IllegalStateException("Could not resolve ${verb.name} return type") - require(respClass.isData) { "Return type of ${verb.name} must be a data class" } + require(respClass.toClassDescriptor().isData || respClass.isEmptyClassTypeAlias()) { + "Return type of ${verb.name} must be a data class or typealias of Unit" + } } }