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?
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)
and then the semantics of whatever kind of join you use tell you what the results should be
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
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 :)
(Its also a bit controversial, maybe?)
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.
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.Sorry I didn’t quite get you. The above library isn’t listed in my lein deps :tree
I’m not familiar with lein, perhaps there’s some user-level profile that adds the dependency to all your projects?
But it’s clear that there’s #ordered/set
from ordered/ordered
that conflicts with #ordered/set
from flatland.ordered.set
Great that worked! I excluded ordered from a library called print.foo
How did you find out that it was ordered that was causing the conflict?
It’s right there in the error message :)
.m2/ordered/ordered/1.3.2
Oh damn 🙂 Thanks a lot!
lacinia version is the latest “0.38.0-alpha-2”
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
)
Maybe you’ll have some luck excluding the other instance of org.flatland/ordered
No, we don’t have that library vendored anymore. That was temporary while the lib was in a bad state.
We use org.flatland/ordered “1.5.9”