huehnerlady
11/09/2020, 12:35 PMShane Myrick
11/09/2020, 5:40 PMgraphql-kotlin-spring-server
, you unfortunately can not use Spring MVC as we run on top of Spring WebFlux and the two implementations are not compatible:
https://expediagroup.github.io/graphql-kotlin/docs/spring-server/spring-overview
However if you are using just graphql-kotlin-schema-generator
and running your own server on Spring MVC, or if you migrate to graphql-kotlin-spring-server
, you can still have private
properties as member of your classes and they will not get exposed as schema fields. Then you can use these clients in your functions
You can see some examples in the docs: https://expediagroup.github.io/graphql-kotlin/docs/spring-server/spring-schemahuehnerlady
11/11/2020, 6:29 AMgraphql-kotlin-schema-generator
and not spring-server? Unfortunately the docs you linked are all about spring-serverDariusz Kuc
11/11/2020, 2:51 PMlateinit
properties (but it implies they have to be non-nullable) and then use custom data fetcher factory provider that can provide custom resolver for the lateinit field as wellhuehnerlady
11/13/2020, 7:02 AMoverride fun propertyDataFetcherFactory(kClass: KClass<*>, kProperty: KProperty<*>): DataFetcherFactory<Any?> =
DataFetcherFactory<Any?> {
when (kProperty) {
Class::property -> fetching { it: Class ->
doMyCustomLogik(it.id)
}
else -> PropertyDataFetcher(kProperty.name) //this is done in the SimpleDataFetcher
}
}
}
This feels a bit hacky, but is the best solution I could find so far 🙂Dariusz Kuc
11/13/2020, 11:52 AMhuehnerlady
11/13/2020, 12:09 PM