Skip to content

Commit

Permalink
Fix issue with union type
Browse files Browse the repository at this point in the history
  • Loading branch information
sav007 committed Feb 14, 2017
1 parent 8ce085a commit cba70d7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data class Field(

private fun toTypeName(responseType: String, typesPackage: String,
customScalarTypeMap: Map<String, String>): TypeName {
val packageName = if (fields?.any() ?: false || hasFragments()) "" else typesPackage
val packageName = if (isNonScalar()) "" else typesPackage
return JavaTypeResolver(customScalarTypeMap, packageName).resolve(responseType, isOptional())
}

Expand Down Expand Up @@ -71,7 +71,7 @@ data class Field(

fun isNonScalar() = hasFragments() || (fields?.any() ?: false)

fun hasFragments() = fragmentSpreads?.any() ?: false
fun hasFragments() = (fragmentSpreads?.any() ?: false) || (inlineFragments?.any() ?: false)

fun isOptional(): Boolean = isConditional || !methodResponseType().endsWith("!")
}

0 comments on commit cba70d7

Please sign in to comment.