Fork me on GitHub
#graphql
<
2020-03-10
>
hlship02:03:01

GraphQL supports query variables (http://spec.graphql.org/draft/#sec-Language.Variables) as a very good way to avoid string-bashing. It's effectively like variables in a SQL prepared statement. Internally, we have extended that with the concept of a server-stored query, where the client sends up a query ID and a variables map; this helps to minimize the size of the request from the client, which can be critical for mobile apps.

kwladyka09:03:10

hmm the trick with variables can work maybe. This is still not what I was thinking about, but small step further

isak15:03:34

From the thing I posted yesterday:

(v/graphql-query {:venia/queries [[:employee {:id 1 :active true} [:name :address [:friends [:name :email]]]]]})

=> "{employee(id:1,active:true){name,address,friends{name,email}}}"
Isn't that what you were asking for, @kwladyka?

kwladyka15:03:02

@isak thank you, something like that. But while the library is not maintained 2 years and not popular I am not enough brave to use this 😕

kwladyka15:03:40

Maybe I will find code responsible for that in one of popular libraries which are actively maintained

mynomoto16:03:35

This is a more maintained venia fork https://github.com/district0x/graphql-query I have been using venia for a long time, it works really well for what I need (adding a pr or two over the time 😉 )

4
kwladyka18:03:06

hah I know this repo, I was working for district0x 😉