Skip to content

Commit

Permalink
fix: allow empty return types in kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
worstell committed Nov 14, 2023
1 parent c72c615 commit ffa7f54
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

Expand Down

0 comments on commit ffa7f54

Please sign in to comment.