pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
souenzzo 2020-06-22T12:08:46.242200Z

@andrzej.fricze pathom and EQL ecosystem are "another approach" GraphAPI's you can do a lot of things that graphql do, things that graphql can't do, and maybe there is things that only graphql do. pathom has the concept of placeholders, that you can use to "mimic" HeroNameAndFriends

[{:>/HeroNameAndFriends [{(:hero {:episode episode})
                          [:name {:friends [:name]}]}]}]
Also, you can create your own a function that merge args and query as GraphQL do
(letfn [(apply-args-in-query [{:keys [query args]}]
          (->> query
               eql/query->ast
               (eql/transduce-children (map (fn [{:keys [params] :as node}]
                                              (if params 
                                                (assoc node 
                                                  :params (into {}
                                                                (map (fn [[k v]]
                                                                       [k (get args v v)]))
                                                                params))
                                                node))))
               eql/ast->query))]
  (apply-args-in-query {:query '[{:>/HeroNameAndFriends [{(:hero {:episode :$episode})
                                                          [:name {:friends [:name]}]}]}]
                        :args  {:$episode 42}}))
=> [{:>/HeroNameAndFriends [({:hero [:name {:friends [:name]}]} {:episode 42})]}]

fricze 2020-06-22T16:54:43.243Z

I see, thanks so much for explanation @souenzzo