Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin: Fix syntax for unary constructor when parent has type parameters #79

Merged
merged 2 commits into from
Mar 8, 2024

Conversation

tadfisher
Copy link
Collaborator

For the Haskell type

data CursorInput a
  = CursorInputNextPage (Maybe a)
  | CursorInputPreviousPage a
  | CursorInputUnknown

we're generating:

@JsonClassDiscriminator("direction")
@Serializable
sealed class CursorInput<A> {
    @Serializable
    @SerialName("nextPage")
    data class NextPage<A>(val key: A?) : CursorInput<A>()

    @Serializable
    @SerialName("previousPage")
    data class PreviousPage<A>(val key: A) : CursorInput<A>()

    @Serializable
    @SerialName("unknown")
    data object Unknown<A> : CursorInput<A>()
}

when it should be:

@JsonClassDiscriminator("direction")
@Serializable
sealed class CursorInput<A> {
    @Serializable
    @SerialName("nextPage")
    data class NextPage<A>(val key: A?) : CursorInput<A>()

    @Serializable
    @SerialName("previousPage")
    data class PreviousPage<A>(val key: A) : CursorInput<A>()

    @Serializable
    @SerialName("unknown")
    data object Unknown : CursorInput<Nothing>()
}

@tadfisher tadfisher requested a review from josephsumabat March 8, 2024 00:53
@tadfisher tadfisher merged commit df1fbcc into master Mar 8, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants