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

Union Annotations Do Not Play Well with @GraphQLDescription and @Deprecated #1941

Open
danadajian opened this issue Mar 19, 2024 · 0 comments
Labels
type: bug Something isn't working

Comments

@danadajian
Copy link

danadajian commented Mar 19, 2024

Library Version
Latest (7.0.2)

Describe the bug
Using Kotlin annotation classes to define unions does not work with @Deprecated and sometimes does not work with @GraphQLDescription.

To Reproduce
If you define an annotation class for a union like so:

@GraphQLUnion(
    name = "MyUnion",
    possibleTypes = [SomeUnionType::class],
    description = "Some union"
)
annotation class MyUnion

then the following will fail the graphqlGenerateSDL task with Cannot convert kotlin.Any? since it is not a valid GraphQL type or outside the supported packages:

data class MyType(
    @GraphQLDescription("Some description")
    @MyUnion
    val myField: Any? = null
)
data class MyType(
    @MyUnion
    @Deprecated("This is deprecated")
    val myField: Any? = null
)
data class MyType(
    @Deprecated("This is deprecated")
    @MyUnion
    val myField: Any? = null
)

Expected behavior
All of the above data classes should be translated to SDL without error, since Kotlin annotations should not care about order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Development

No branches or pull requests

1 participant