https://kotlinlang.org logo
#serialization
Title
# serialization
d

Dariusz Kuc

01/26/2023, 2:03 AM
Hello 👋 I'm hitting https://youtrack.jetbrains.com/issue/KT-39491 whenever I got both spring boot and kotlinx-serialization plugins applied to a project. Based on Spring docs it should be supported so just wondering what I might be missing. This is the class that blows up (complains about
Variables
)
Copy code
public const val HELLO_WORLD_QUERY: String =
    "query HelloWorldQuery(${'$'}name: String) {\n  helloWorld(name: ${'$'}name)\n}"

@Generated
@Serializable
public class HelloWorldQuery(
  public override val variables: HelloWorldQuery.Variables,
) : GraphQLClientRequest<HelloWorldQuery.Result> {
  @Required
  public override val query: String = HELLO_WORLD_QUERY

  @Required
  public override val operationName: String = "HelloWorldQuery"

  public override fun responseType(): KClass<HelloWorldQuery.Result> = HelloWorldQuery.Result::class

  @Generated
  @Serializable
  public data class Variables(
    public val name: String? = null,
  )

  @Generated
  @Serializable
  public data class Result(
    public val helloWorld: String,
  )
}
Any ideas what I might be missing? Code compiles fine if I don't apply spring plugins -- edit --- dropped optional input wrappers to simplify the example code (still blows up)
it appears that removing Kotlin Spring Boot plugin (i.e. the one that opens up the classes) fixes the issue and you can use
kotlinx-serialization
with
spring-boot
plugins. depending on the size of the project this might be somewhat annoying to have to manually open up all the components
3 Views