Fork me on GitHub
#pathom
<
2022-07-13
>
rodolfo18:07:16

👋 Hello folks! Is there a way to generate a query from an existing sample data structure? The closest I could find is the shape-descriptor https://pathom3.wsscode.com/docs/shape-descriptor, but I wanted to have the corresponding query for it, already in EQL. Basically I have this:

{:user/name         "usuario"
 :user/billing-card {:card/number "123"}
 :user/friends      [{:user/id 1}
                     {:user/id 2}]}
And I wanted this:
[:user/name
 {:user/billing-card [:card/number]}
 {:user/friends [:user/id]}]
(Mine is a much more complex data structure with way more nested fields, hence the question)

👀 1
1
sheluchin18:07:11

#meander or something similar might be helpful in a case like this. Not sure if Pathom itself has any helpers.

sheluchin18:07:35

That's awesome.

🙏 1
rodolfo19:07:56

@U066U8JQJ wow, thanks! I was able to get it using https://gist.github.com/rodolfo42/12b02412058d3f57827a105133779da9 I just wrote, probably full of corner cases, but nice to know I can use that fn!

wilkerlucio19:07:41

that one is solid, you can count on it, its been around since Pathom 2 😉

🙏 1
rodolfo23:07:34

Thanks again @U066U8JQJ

🥜 1