@@ -4,6 +4,7 @@ import com.cjbooms.fabrikt.configurations.Packages
4
4
import com.cjbooms.fabrikt.generators.GeneratorUtils
5
5
import com.cjbooms.fabrikt.generators.GeneratorUtils.getPrimaryContentMediaType
6
6
import com.cjbooms.fabrikt.generators.GeneratorUtils.getPrimaryContentMediaTypeKey
7
+ import com.cjbooms.fabrikt.generators.GeneratorUtils.hasAnySuccessResponseSchemas
7
8
import com.cjbooms.fabrikt.generators.GeneratorUtils.hasMultipleContentMediaTypes
8
9
import com.cjbooms.fabrikt.generators.GeneratorUtils.hasMultipleSuccessResponseSchemas
9
10
import com.cjbooms.fabrikt.generators.GeneratorUtils.toClassName
@@ -37,16 +38,18 @@ object ClientGeneratorUtils {
37
38
* If no response body is found, Unit is returned.
38
39
*/
39
40
fun Operation.getReturnType (packages : Packages ): TypeName {
40
- return if (hasMultipleSuccessResponseSchemas()) {
41
- JsonNode ::class .asTypeName()
42
- } else {
43
- this .getPrimaryContentMediaType()?.let {
44
- toModelType(
45
- packages.base,
46
- KotlinTypeInfo .from(it.value.schema)
47
- )
48
- } ? : Unit ::class .asTypeName()
49
- }
41
+ return if (! hasAnySuccessResponseSchemas()){
42
+ Unit ::class .asTypeName()
43
+ } else if (hasMultipleSuccessResponseSchemas()) {
44
+ JsonNode ::class .asTypeName()
45
+ } else {
46
+ this .getPrimaryContentMediaType()?.let {
47
+ toModelType(
48
+ packages.base,
49
+ KotlinTypeInfo .from(it.value.schema)
50
+ )
51
+ } ? : Unit ::class .asTypeName()
52
+ }
50
53
}
51
54
52
55
fun Operation.toClientReturnType (packages : Packages ): TypeName {
0 commit comments