This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-30
Channels
- # announcements (1)
- # babashka (15)
- # calva (3)
- # cider (1)
- # clj-kondo (16)
- # clj-on-windows (1)
- # cljfx (1)
- # clojure (25)
- # clojure-europe (6)
- # clojure-spec (15)
- # cursive (13)
- # emacs (11)
- # fulcro (2)
- # humbleui (7)
- # introduce-yourself (1)
- # jackdaw (1)
- # off-topic (10)
- # pathom (5)
- # portal (3)
- # re-frame (7)
- # reagent (12)
- # releases (1)
- # shadow-cljs (8)
- # tools-build (18)
- # web-security (10)
@wilkerlucio Inferring input from the destructuring doesn’t also infer nesting. What are your thoughts on a change to support this?
(pco/defresolver foo
[{{{son :son} :father} :grandpa}]
{:grandpa son})
=> #'com.calebmacdonaldblack.foo/foo
foo
=>
#com.wsscode.pathom3.connect.operation.Resolver{:config #:com.wsscode.pathom3.connect.operation{:input [:grandpa],
:provides {:grandpa {}},
:output [:grandpa],
:inferred-input [:grandpa],
:op-name com.calebmacdonaldblack.foo/foo,
:requires {:grandpa {}}},
:resolve #object[com.calebmacdonaldblack.foo$foo__21752
0x6f873565
"com.calebmacdonaldblack.foo$foo__21752@6f873565"]}
hello, that's by design
yes, we could support it, but I think at that point is better to have it explicitly, otherwise its kinda painful to read
Some examples of what I mean
(deftest extract-destructure-map-as-input-test
(testing "Simple flat params"
(is (= [:foo :bar]
(extract-destructure-map-as-input
'{foo :foo
bar :bar}))))
(testing "Nested input"
(is (= [{:foo [{:bar [:buzz :y :a :b :c]}
:x]}]
(extract-destructure-map-as-input
'{{{fizz :buzz y :y :keys [a b c]} :bar x :x} :foo}))))
(testing "Nested input with vector destructuring"
(is (= [:foo]
(extract-destructure-map-as-input
'{[foo1 foo2] :foo}))))
(testing "Nested input with vector destructuring and more nesting"
(is (= [{:foo [:bar]}]
(extract-destructure-map-as-input
'{[{bar :bar}] :foo}))))
(testing "Simple flat params with symbol keys"
(is (= [:foo :bar]
(extract-destructure-map-as-input
'{:keys [foo bar]}))))
(testing "Simple flat params with keyword keys"
(is (= [:foo :bar]
(extract-destructure-map-as-input
'{:keys [:foo :bar]}))))
(testing "Simple flat params with namespaced symbol keys"
(is (= [:ns/foo :ns/bar]
(extract-destructure-map-as-input
'{:keys [:ns/foo :ns/bar]})))))