Oleg / Feb 09 2021 / Published
Remix of Clojure by Nextjournal
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
com.wsscode/pathom {:mvn/version "2.3.0"}
;; complient is used for autocompletion
;; add your libs here (and restart the runtime to pick up changes)
compliment/compliment {:mvn/version "0.3.9"}}}
deps.edn
Extensible Data Notation
(require [com.wsscode.pathom.core :as p])
(require [com.wsscode.pathom.connect :as pc])
0.0s
Clojure
(let [fns [(pc/resolver api-input->
{::pc/input {:api/input}
::pc/output [:aaa/input :bbb/input]}
(fn [env input]
(if (rand-nth [true false])
{:aaa/input {}}
{:bbb/input {}})))
(pc/resolver aaa-input->aaa-output
{::pc/input {:aaa/input}
::pc/output [:aaa/output]}
(fn [env input]
{:aaa/output {}}))
(pc/resolver aaa-output->api-output
{::pc/input {:aaa/output}
::pc/output [:api/output]}
(fn [env input]
{:api/output {:aaa true}}))
(pc/resolver bbb-input->bbb-output
{::pc/input {:bbb/input}
::pc/output [:bbb/output]}
(fn [env input]
{:bbb/output {}}))
(pc/resolver bbb-output->api-output
{::pc/input {:bbb/output}
::pc/output [:api/output]}
(fn [env input]
{:api/output {:bbb true}}))]
parser (p/parser
{::p/env {::p/reader [p/map-reader
pc/reader2
pc/open-ident-reader]}
::p/plugins [(pc/connect-plugin {::pc/register fns})]})]
(parser {} [{[:api/input true] [:api/output]}]))
0.1s
Clojure