Fork me on GitHub
#pathom
<
2020-08-08
>
yenda12:08:01

Is is possible to make the parser use idents in nested queries and put the node at the top level of the output to avoid repetition? Example:

{[user/id "x"] {:user/name "bob}
 :comments [{:message "yo" :>/user [:user/id "x"]}
            {:message "hi" :>/user [:user/id "x"]}]}

wilkerlucio13:08:11

from pathom perspective, no, ident normalization is not a concept in pathom, given in Pathom idents just mean setting a value. this also respects a principle that the shape of the response must match the shape of the query, this avoids the user having to deal with complicated things to understand the output shape, by always being the same is simple and predictable

wilkerlucio13:08:30

what you can do is write some post-processing plugin to move things around after the response is built, makes sense?

yenda14:08:52

is the placeholder plugin a post processing too? Because what I want to do is basically instead of putting the content, put the indent and move the content to the top level

wilkerlucio16:08:54

I don't fully understand yet what you are trying to do. can you send a more complete example, with the queyr, and an example of the result structure you are trying to achieve?

yenda12:08:56

The motivation for that being obviously that it can drastically reduce the size of the response, and it also fits much better with libraries like re-frame which will be perfectly capable of exploiting normalized data like this, instead of having to re-parse and normalize client side