ExpediaGroup / graphql-kotlin

Libraries for running GraphQL in Kotlin
https://opensource.expediagroup.com/graphql-kotlin/
Apache License 2.0
1.74k stars 351 forks source link

kotlin 2.0.x support. problem with SchemaGeneratorHooks #2019

Open cryptoki opened 4 months ago

cryptoki commented 4 months ago

hi.

if I use graphql-kotlin 8.0.0-alpha.3 together with kotlin 2.0.0, then our custom SchemaGeneratorHooks is ignored. graphl-java is set to 22.1. We ignore few properties, hence we created a CustomSchemaGeneratorHooks and implemented the method isValidProperty which is returns false for the specific property. Up to kotlin 1.9.x. everything works well. I saw that you are upgrading to Kotlin version 1.9.x in the new graphql-kotlin 8.x.

what is your plan to support kotlin 2.0? what is your recommendation when dealing with kotlin 2.0.0?

thanks.

class CustomSchemaGeneratorHooks : SchemaGeneratorHooks {
..
  override fun isValidProperty(kClass: KClass<*>, property: KProperty<*>): Boolean {
...
  }
..
}

Config

    val schema = toSchema(
        config = SchemaGeneratorConfig(
            supportedPackages = listOf("de.  ..  .graphql"),
            hooks = CustomSchemaGeneratorHooks(),
        ),
..

at the creation / app startup I printed out the schema

    log.info("{}", schema.print())