graphql

hlship 2020-09-10T00:04:03.024300Z

Exactly, it seems like they could have used introspection to get all the data they need.

hadils 2020-09-10T16:01:25.025800Z

Hi -- how do I get the parsed query from the request? I need to check it as @hlship described above.

hlship 2020-09-10T16:21:37.026400Z

It's is placed onto the :request object as key :parsed-lacinia-query. (see https://github.com/walmartlabs/lacinia-pedestal/blob/78077efc551d2fc1744f3b17c4ddf9ee3616668d/src/com/walmartlabs/lacinia/pedestal2.clj#L97)

hadils 2020-09-10T16:25:30.027Z

Thanks @hlship! I was having a hard time finding from my logs.

hlship 2020-09-10T16:32:05.027500Z

Breaking the logic up into a bunch of interceptors makes it possible to "slip" in

hlship 2020-09-10T16:32:10.027800Z

extra logic, like auth/auth, etc.

hlship 2020-09-10T16:32:18.028200Z

But it means that the logic is a bit scattered about.

hlship 2020-09-10T16:32:24.028500Z

Fortunately, it's only a little bit of code either way.

emccue 2020-09-10T17:39:13.028800Z

(defn ^:private interceptors
  [schema]
  (-> (p2/default-interceptors schema nil)
      (inject user-info-interceptor ::after ::p2/inject-app-context)))

emccue 2020-09-10T17:39:19.029Z

is this example supposed to work?

emccue 2020-09-10T17:39:41.029700Z

the ::p2/inject-app-context doesn't seem like valid syntax

emccue 2020-09-10T17:39:50.030Z

and idk what the actual interceptors are named

hlship 2020-09-10T18:38:47.031Z

Yes, I believe that is correct; that's the inject-app-context keyword in the p2 namespace (alias for com.walmartlabs.lacinia.pedestal2). See https://walmartlabs.github.io/apidocs/lacinia-pedestal/com.walmartlabs.lacinia.pedestal2.html#var-default-interceptors for the default list/names.

hlship 2020-09-10T21:24:32.031400Z

There is a typo on that page, ::after should be :after.

hlship 2020-09-10T21:24:35.031600Z

I'll fix.