In my understanding graphql-kotlin does not suppor...
# graphql-kotlin
m
In my understanding graphql-kotlin does not support persisted queries out of the box. How difficult it would be to add this support?
d
depends whether you are looking for automatic persisted queries or not -> if you pre-register your persisted queries then you could just add another endpoint that would take the SHA, retrieve the query and then process it so should be fairly "easy"
automatic negotiations and registering the queries will be a little bit more complex
m
Thanks, I guess going with manual approach should be fine. Any pointer to how can I switch from my endpoint controller (assuming my persisted query handler) and call graphql engine directly by providing the query with parameters and calling the eingine without going through
/graphql
endpoint - ideally I'd like to expose only persisted queries in our prod environment and disable
/graphql
endpoint completely (security team asks for this).
d
in the simplest form you would need to inject an instance of
GraphQL
bean, somehow map the query SHA to a query and then use it to create
ExecutionInput
i.e. something like https://github.com/ExpediaGroup/graphql-kotlin/blob/master/servers/graphql-kotlin-[…]/expediagroup/graphql/server/execution/GraphQLRequestHandler.kt
m
Perfect, thanks 🙂
s
You can also do this in the one level in the
GraphQLServer
https://github.com/ExpediaGroup/graphql-kotlin/blob/669d62b022b798be315c18a62d9a06[…]tlin/com/expediagroup/graphql/server/execution/GraphQLServer.kt You can override the entire method or the individual,
GraphQLRequestParser
,
GraphQLContextFactory
, and
GraphQLRequestHandler
m
Thanks, will look into that 🙂