This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-06
Channels
- # beginners (90)
- # boot (83)
- # cider (39)
- # clara (4)
- # cljs-dev (124)
- # cljsrn (10)
- # clojure (208)
- # clojure-boston (1)
- # clojure-italy (13)
- # clojure-nlp (3)
- # clojure-russia (34)
- # clojure-spec (63)
- # clojure-uk (101)
- # clojurescript (65)
- # community-development (13)
- # copenhagen-clojurians (1)
- # core-async (1)
- # cursive (24)
- # datascript (1)
- # datomic (65)
- # emacs (20)
- # graphql (20)
- # hoplon (21)
- # instaparse (18)
- # jobs (5)
- # jobs-discuss (2)
- # leiningen (8)
- # luminus (32)
- # midje (1)
- # mount (3)
- # off-topic (18)
- # om (10)
- # parinfer (6)
- # pedestal (2)
- # planck (2)
- # precept (22)
- # protorepl (7)
- # re-frame (45)
- # reagent (9)
- # ring (1)
- # ring-swagger (4)
- # rum (2)
- # spacemacs (5)
- # sql (2)
- # unrepl (13)
- # untangled (8)
- # yada (5)
@hlship Does Lacinia enforce the presence of a return type for a mutation? (I was building a simple delete of an entity and was wondering if I have to absolutely provide a return :type in the schema.)
I might have my answer:
#error {
:cause Could not process type.
:data {:type nil}
:via
[{:type clojure.lang.Compiler$CompilerException
:message clojure.lang.ExceptionInfo: Could not identify type of field. {:field {:description "Share a project to another user.", :args {:projectId {:type (non-null ID)}, :email {:type (non-null String)}}, :resolve #object[blueprint.graphql.mutations$project_share 0x37156bfb "blueprint.graphql.mutations$project_share@37156bfb"]}}, compiling:(base_resolver.clj:11:13)
:at [clojure.lang.Compiler$InvokeExpr eval Compiler.java 3657]}
{:type clojure.lang.ExceptionInfo
:message Could not identify type of field.
:data {:field {:description Share a project to another user., :args {:projectId {:type (non-null ID)}, :email {:type (non-null String)}}, :resolve #object[blueprint.graphql.mutations$project_share 0x37156bfb blueprint.graphql.mutations$project_share@37156bfb]}}
:at [clojure.core$ex_info invokeStatic core.clj 4617]}
{:type clojure.lang.ExceptionInfo
:message Could not process type.
:data {:type nil}
:at [clojure.core$ex_info invokeStatic core.clj 4617]}]
Yes, mutations must have a :type. Typically, the :type corresponds to the object just modified; on a delete, you may want some kind of Ok
placeholder.
Pending code destined for 0.19.0 beefs up the spec for the schema. Most of the cases discussed here will result in spec exceptions.
I'm starting to look at GraphQL subscriptions w/ Pedestal. I'm modelling it on Apollo: https://github.com/apollographql/subscriptions-transport-ws If I do a good job, the Apollo client will work with lacinia-pedestal.
.. I'm guessing quite a bit, since it's written in TypeScript which I've never learnt. Ah, this helps: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md
@hlship that would be great. Note that Relay Modern should also be able to support subscriptions of this kind
Just puzzling it all out. It answers my internal question about how the client knows when the subscription completed, rather than hit a network partition or server crash. I'll be putting something provisional together and then probably need to iterate a bit.
I'm hoping that there's a good way to reuse most of the existing Pedestal code, but Pedestal interceptor chain doesn't feel like a perfect fit here.
I don’t think there is strict specification for GraphQL subscriptions anyway. For the transport that is. Apollo has their approach, but Relay Modern for example seems completely agnostic.
No, there isn't a strict transport solution. I'll need to look at Relay Modern as well, but I suspect these things layer on each other.
Something that you would need to get right imo is authentication / authorisation with subscriptions. e.g. have an easy way to filter out outgoing messages and ensure they are only sent to the right clients
This issue gives some insights on how to deal with subscriptions with Relay modern: https://github.com/facebook/relay/issues/1655
Looks like auth/auth should only happen once, on initial connection. After that, it's a private connection between that client and the server.
What model were you thinking of to push new updates to a subscription on the backend?