graphql

hlship 2019-03-26T04:13:56.088800Z

No, I'm afraid there isn't a way to get data out of the wrapped types; they're opaque and dependent on internal APIs. That being said, it's an area we could improve in the future.

hlship 2019-03-26T04:14:28.089300Z

It's always easier to start very strict and gradually loosen up than it is to do the opposite.

Matt Butler 2019-03-26T08:53:58.091900Z

Gotcha, for my purposes (test that checks that errors are always caught and end up with a resolved with error promise I think I can get away with type checking. Thanks for the help :)

urzds 2019-03-26T18:55:49.093100Z

@oliy @hiredman @lennart.buit: Regarding authentication of GraphQL requests: I have the Pedestal interceptor set up to add an :authorization field to the context, but in Lacinia's context I cannot find that field. Any idea what I need to do?

urzds 2019-03-26T19:23:38.095100Z

Figured it out by reading the inject-app-context-interceptor: https://github.com/walmartlabs/lacinia-pedestal/blob/master/src/com/walmartlabs/lacinia/pedestal.clj#L315 I need to (assoc-in [:request :lacinia-app-context :authorization] data)) into the Pedestal context in an interceptor. Lacinia will apparently put everything in the :request :lacinia-app-context key in the Lacinia resolver context.

souenzzo 2019-03-26T19:29:40.096600Z

there is some lacinia function that turns the query string into a clojure datastructure? (lacinicia/parse-query schema "{hello}") => {:op :query :key :hello ...} SOLVED: com.walmartlabs.lacinia.parser.query/parse-query tnks

urzds 2019-03-26T19:53:56.099300Z

@hiredman @oliy @lennart.buit: Again regarding authentication: How does this work for WebSockets? I understand I should send an "initial payload" to the server that contains the authentication token. But where would I receive that? I assume it is not the same regular Pedestal interceptor that I use to check the token in the HTTP header for GraphQL-over-HTTP queries? Where do I need to look for that initial payload in my server code?

2019-03-26T19:54:32.099700Z

I must admit that a coworker of mine did something with that, but I haven’t

2019-03-26T19:54:58.100Z

So, I wouldn’t be able to tell you

2019-03-26T19:56:15.100300Z

I am not using pedestal, so I don't know. I start a stateful go loop that consumes messages from a socket io socket, and until it gets an authentication message it ignores graphql messages

2019-03-26T19:56:43.101100Z

@urzds I can't remember right now, but I can have a look in the codebase at work and let you know tomorrow

2019-03-26T19:58:48.101600Z

Also, you can just ask your questions in this channel in general. There are plenty of people here willing to help! No need to mention specific people

urzds 2019-03-26T19:59:08.102100Z

@hiredman So you wrote a replacement for "lacinia-pedestal" that builds solely on http://socket.io? Is that available somewhere?

urzds 2019-03-26T20:00:06.102200Z

OK! Just thought because y'all gave the initial suggestion regarding interceptors for HTTP / initial payloads for WebSockets.

urzds 2019-03-26T20:00:30.102600Z

@oliy Thanks! That would be very helpful.

2019-03-26T20:02:06.102700Z

no worries! Totally willing to help, but some people may be more “annoyed” by being mentioned so to say

urzds 2019-03-26T20:04:28.104700Z

OK... Turns out one needs to read the correct documentation. There is nothing about this in the Lacinia docs, but the Lacinia Pedestal docs have reasonable hints on how to achieve this: • https://lacinia-pedestal.readthedocs.io/en/latest/subscriptions.html (regarding the general concepts) • https://walmartlabs.github.io/apidocs/lacinia-pedestal/com.walmartlabs.lacinia.pedestal.subscriptions.html (shows me that there are default-subscription-interceptors - similar to the HTTP case - which contain a ::inject-app-context interceptor, which I should overwrite / extend)

urzds 2019-03-26T20:05:12.104900Z

I'll try that tomorrow. 🙂