Skip to content

Commit

Permalink
Merge pull request #194 from sav007/bug-183/union-type
Browse files Browse the repository at this point in the history
Fix issue with union type
  • Loading branch information
digitalbuddha authored Feb 14, 2017
2 parents 8ce085a + cba70d7 commit 7591820
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 7591820

Please sign in to comment.