https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
m

Martin Brehovsky

05/17/2021, 11:51 AM
In my understanding graphql-kotlin does not support persisted queries out of the box. How difficult it would be to add this support?
d

Dariusz Kuc

05/17/2021, 2:55 PM
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

Martin Brehovsky

05/17/2021, 9:03 PM
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

Dariusz Kuc

05/17/2021, 9:36 PM
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

Martin Brehovsky

05/17/2021, 10:09 PM
Perfect, thanks 🙂
s

Shane Myrick

05/18/2021, 3:30 PM
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

Martin Brehovsky

05/19/2021, 4:32 PM
Thanks, will look into that 🙂
28 Views