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.
It's always easier to start very strict and gradually loosen up than it is to do the opposite.
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 :)
@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?
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
.
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
@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?
I must admit that a coworker of mine did something with that, but I haven’t
So, I wouldn’t be able to tell you
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
@urzds I can't remember right now, but I can have a look in the codebase at work and let you know tomorrow
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
@hiredman So you wrote a replacement for "lacinia-pedestal" that builds solely on http://socket.io? Is that available somewhere?
OK! Just thought because y'all gave the initial suggestion regarding interceptors for HTTP / initial payloads for WebSockets.
@oliy Thanks! That would be very helpful.
no worries! Totally willing to help, but some people may be more “annoyed” by being mentioned so to say
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)
I'll try that tomorrow. 🙂