graphql

orestis 2020-03-13T05:31:20.079100Z

Why do you need to replace variables ? They are first class in graphql, you send them separately.

gklijs 2020-03-13T07:03:02.080700Z

GraphQL is pretty simple in itself. And if you move to subscriptions a lot of libraries are breaking. Not Lacinia 😀.

👍 1
gklijs 2020-03-13T07:06:28.083800Z

But it would be nice, not that hard to build, and usefull to do generative tests on a GraphQL endpoint using introspection. I'm not aware something like it already exists.

2020-03-13T08:31:33.084600Z

@kwladyka if you are interposing strings, you're doing it wrong. See https://graphql.org/learn/queries/#variables

gklijs 2020-03-13T11:49:37.085400Z

5 years GraphQL 🎆 🍰 https://youtu.be/s8meG38iZAM

kwladyka 2020-03-13T21:00:17.089600Z

https://graphql.org/learn/queries/#operation-name what is the point of operations name while response doesn’t use them in data structure?

kwladyka 2020-03-13T21:01:04.090300Z

Is :operationName useful? I see libraries generate them for request.

{:operationName "get_shops",
 :query "query get_shops($uuid: String!) {\n  shop(uuid: $uuid) {\n    uuid\n    name\n    engine\n    config\n  }\n}",
 :variables {"uuid" "00000000-0000-0000-0000-000000000000"}}

kwladyka 2020-03-13T21:05:14.090900Z

Is it happening only with multiple queries? why?

kwladyka 2020-03-13T21:05:32.091300Z

it sounds like make this more complex

chrisulloa 2020-03-13T21:19:52.091700Z

your query can define multiple operations, and in your request you can specify which one you want to call

chrisulloa 2020-03-13T21:20:24.092300Z

The operation name is a meaningful and explicit name for your operation. It is only required in multi-operation documents, but its use is encouraged because it is very helpful for debugging and server-side logging. When something goes wrong (you see errors either in your network logs, or in the logs of your GraphQL server) it is easier to identify a query in your codebase by name instead of trying to decipher the contents
in that same page you linked

kwladyka 2020-03-13T21:31:56.093400Z

sure, but it seems to be strange it doesn’t return response with my operation name when I use 1 query. Just curious why do this for multiple queries, but not for 1? It make extra work for parsing.

chrisulloa 2020-03-13T21:38:59.094Z

you can do it for one query as well, if you decide you want to do something with that information in your graphql server

chrisulloa 2020-03-13T21:40:02.094900Z

i don’t think it really adds much overhead to the parsing

hlship 2020-03-13T22:55:36.095300Z

To be honest, I don't see the need for operationName myself, but it is part of the spec.

hlship 2020-03-13T22:56:33.095900Z

Feels like Facebook UI guys wanted to have one big document with all the possible queries/mutations they would need in one place.

hlship 2020-03-13T22:57:01.096200Z

But that's not, IMO, the best way to use GraphQL.

hlship 2020-03-13T22:57:32.096600Z

It makes slightly more sense if Facebook internally uses something like server-stored queries.

hlship 2020-03-13T22:58:02.097300Z

Which, BTW, are easy to implement, but hard to do properly in a fully generic, pluggable way, which is why it's not part of lacinia-pedestal (at least, not yet).

hlship 2020-03-13T22:58:51.097800Z

But with the way Lacinia operates, operationName adds some unwanted complications to server-stored queries.