https://kotlinlang.org logo
#graphql
Title
# graphql
j

Joe

07/11/2019, 6:36 PM
I'd like one of my queries to return an object containing a list that is represented in memory as a
java.util.streams.Stream
. Ideally I'd be able to have the server response serialized without having to have the full contents of the stream/list in memory at once. I think jackson will serialize it properly once it gets there due to the jdk8 module's StreamSerializer, but am not sure how to get graphql-kotlin to recognize my Stream as a List from a schema perspective. The closest I can get is trying to have a SchemaGeneratorHooks::willGenerateGraphQLType() that returns a GraphQLList, but the GraphQLList constructor needs to get the wrapped type, and I don't see a good way to get from the KType::arguments[0].type to a GraphQLType that corresponds? Maybe if the hooks had access to the generator that could work, but I don't see a way to wire that up? Or are there any other suggestions on how to approach this?