Fork me on GitHub
#pathom
<
2022-06-07
>
roklenarcic15:06:45

How do you handle attributes that kinda require a context to be resolved? For instance let’s say you’ve got: [:folder/id :folder/name :folder/path {:folder/files [:file/id :file/name :file/full-path]}] Here the resolver for full-path would want to have folder/path and file/name but at that point only file/name is available. Now obviously you could generate full-path when resolving folder/files, but let’s say that you want to have a separate resolver for it. That takes folder/path and file/name.

sheluchin16:06:38

You could have a full-path-resolver that specifies its input to be a nested value with all the required data, like ::pco/input [:folder/path {:folder/files [:file/name]}], and pull the necessary data out of the input to form your :file/full-path output.

wilkerlucio16:06:24

as a general guide, you can never look up, only down, so in this specific case I think would be better to use the full path as the primary thing, since its trivial to compute the base name from it

wilkerlucio16:06:43

that or, each level going down needs to forward some information to retain the context