graphql

λustin f(n) 2020-09-22T01:18:36.003600Z

I am trying to merge together two representations of a user from different sources. Is there a guide or best practices I should use for this? Is it mostly a matter of having the resolver for the type 'know' the different sources the data comes from, and be built to determine which source to pull from to provide the proper fields?

2020-09-22T17:35:43.003700Z

not sure how helpful this is, but I would approach it as some kind of sql join(as a mental model, even if the underlying datasources aren't sql)

2020-09-22T17:36:52.003900Z

and then the semantics of whatever kind of join you use tell you what the results should be

2020-09-22T20:07:53.004700Z

I guess I would do ik like you describe, have a resolver high up that knows about both sources, and combine a value that field resolvers ‘deeper’ can use to resolve. There is an api to preview selections, so your all knowing ‘high’ field resolver can know which datasources it needs to query, say because its expensive

2020-09-22T20:09:29.005Z

The alternative, if the type is really split between services (for whatever reason) is Federation, but thats a pretty hard handed solution for a scaling / scattered data problem I don’t think you describe to have :)

2020-09-22T20:13:30.005300Z

(Its also a bit controversial, maybe?)

hlship 2020-09-22T18:41:06.004600Z

I’m finding a lot of bugs related to directives as I’m working on exposing a solid (protocol-based) API to get at them.

jacklombard 2020-09-22T20:46:18.006900Z

I get this error when adding lacinia to my project

clojure.lang.ExceptionInfo: Conflicting data-reader mapping {:url #object[java.net.URL 0x792b749c "jar:file:/Users/sunil.ks/work/qt/sketches/.m2/ordered/ordered/1.3.2/ordered-1.3.2.jar!/data_readers.clj"], :conflict ordered/set, :mappings {ordered/set #'flatland.ordered.set/into-ordered-set, ordered/map #'flatland.ordered.map/ordered-map, dbg #'cider.nrepl.middleware.debug/debug-reader, break #'cider.nrepl.middleware.debug/breakpoint-reader, light #'cider.nrepl.middleware.enlighten/light-reader}}
It is because of org.flatland/ordered and I’m not sure how to resolve this.

jacklombard 2020-09-23T07:00:54.003400Z

Sorry I didn’t quite get you. The above library isn’t listed in my lein deps :tree

orestis 2020-09-23T08:10:26.003600Z

I’m not familiar with lein, perhaps there’s some user-level profile that adds the dependency to all your projects?

orestis 2020-09-23T08:11:36.003800Z

But it’s clear that there’s #ordered/set from ordered/ordered that conflicts with #ordered/set from flatland.ordered.set

jacklombard 2020-09-23T08:33:24.004Z

Great that worked! I excluded ordered from a library called print.foo

jacklombard 2020-09-23T08:33:51.004200Z

How did you find out that it was ordered that was causing the conflict?

orestis 2020-09-23T09:46:38.004700Z

It’s right there in the error message :)

orestis 2020-09-23T09:47:08.005400Z

.m2/ordered/ordered/1.3.2

jacklombard 2020-09-23T09:47:24.005600Z

Oh damn 🙂 Thanks a lot!

jacklombard 2020-09-22T20:47:21.007200Z

lacinia version is the latest “0.38.0-alpha-2”

2020-09-22T21:00:21.008Z

I believe lacinia has a vendorized version of that lib, so you have the same clj file twice on your classpath (because you also depend on org.flatland/ordered )

2020-09-22T21:03:31.008600Z

Maybe you’ll have some luck excluding the other instance of org.flatland/ordered

hlship 2020-09-22T21:33:50.009100Z

No, we don’t have that library vendored anymore. That was temporary while the lib was in a bad state.

👍 1
hlship 2020-09-22T21:34:16.009400Z

We use org.flatland/ordered “1.5.9”