ExpediaGroup/graphql-kotlin

graphq-kotlin-client code generator with duplicated fields

Closed this issue · 0 comments

Library Version
What version are you using?
latest.

Describe the bug

[Error] Conflicting declarations: public final val text: String, public final val text: String

Generated data classes contain duplicated fields when using unions

To Reproduce
Steps to reproduce the behavior. Please provide:

interface EGDSText {
    text: String!
}
type EGDSPlainText implements EGDSText {
    text: String!
}
union ProductRatingSupportingMessage = EGDSPlainText | ProductRatingLink

union ProductSupportingMessage = EGDSGraphicText | EGDSInlineLink | EGDSParagraph | EGDSPlainText | EGDSStandardBadge | LoyaltyDialogWithTrigger | EGDSLoyaltyBadge

Both ProductRatingSupportingMessage and ProductSupportingMessage share the EGDSPlainText type. However, when generating the Kotlin classes, I get something like this:

@Generated
public data class EGDSPlainText(
  public val text: String,
  public val text: String,
) : ProductRatingSupportingMessage, ProductSupportingMessage

Expected behavior
data classes with unique fields.