graphql

timgilbert 2019-07-17T18:58:21.076600Z

Say, in lacinia is it possible to attach metadata to the response? My use case is I'm trying to instrument some code and determine, eg, which project an event took place in, but I might not actually determine that information until I'm fairly deep in the resolver stack. What I'd like is a mechanism where an arbitrary resolver could figure out "aha, this is project X and user Y", and then when I get the results of (lacinia/execute) I'd like to pull that data back out, but I don't want it to be returned to the client.

timgilbert 2019-07-17T18:59:12.077500Z

Basically I'm wondering if I can get the context object back from execute.

hlship 2019-07-17T20:19:49.079900Z

Lacinia's model isn't super sophisticated; we recurse from the roots to the leaves, then select on the way back up, building the final GraphQL result map leaf-to-root. So that becomes a challenge to do the kind of thing you mention w/o resorting to an Atom. The internal implementation makes use of some Atoms to store errors and a few other things (technically not necessary, but was a big performance operation and kept hidden). This feels like something with-extensions would help with ... even if you then had a Pedestal interceptor removing the extensions before sending response to client. http://walmartlabs.github.io/apidocs/lacinia/com.walmartlabs.lacinia.resolve.html#var-with-extensions

timgilbert 2019-07-17T23:11:34.080200Z

Thanks @hlship, will look into that