Fork me on GitHub
#pathom
<
2020-10-09
>
wilkerlucio13:10:20

hello @markaddleman, doing decomposition resolvers is fine if you wanna give a "name" to a composite structure, one example case that I find interesting to do it is for leiningen style deps, breaking something like :library/path [org.clojure/core.async "1.3.610"] to the attributes :library/symbol :library/version, so this is a legit usage. In your case I see that the composed structure already has all the keys, so you can instead using something like:

wilkerlucio13:10:17

[{([:portfolio/id 123] {:pathom/context {:application/app-key "..."}})}]

wilkerlucio13:10:28

another suggestions from what I'm seeing in your code: 1. I see some unqualified keywords, I strongly recommend to avoid those, they may clash with other names too easely 2. try to think more flat, I see nestings like :portfolio/id {:portfolioKey "Z8X06QFpRXiu7BCyBg2xOg"}, I suggest to avoid those wrappings and just make long attributes that have context-free meaning

bananadance 3
wilkerlucio13:10:58

a common approach is at the edges (when you are hitting some actual service or database), make an adapter and convert any unqualified name to fully qualified ones

markaddleman14:10:17

Thanks. The point of wrapping :portfolioKey with :portfolio/id was to avoid clashing and remain compatible with the backend. I hadn't thought of stripping the namespaces. Good point!