diff --git a/src/main/com/wsscode/pathom3/connect/runner.cljc b/src/main/com/wsscode/pathom3/connect/runner.cljc index 7bd07ea2..680f0b04 100644 --- a/src/main/com/wsscode/pathom3/connect/runner.cljc +++ b/src/main/com/wsscode/pathom3/connect/runner.cljc @@ -492,9 +492,9 @@ (node-missing-input-error-details env node attr) (input-missing-error-message-leaf [node] attr))) -(defn input-missing-detail-OR - [{::pcp/keys [graph]} or-node attr] - (let [resolver-nodes (->> (pcp/node-successors graph (::pcp/node-id or-node)) +(defn input-missing-detail-branch-node + [{::pcp/keys [graph]} branch-node attr] + (let [resolver-nodes (->> (pcp/node-successors graph (::pcp/node-id branch-node)) (map #(pcp/get-node graph %)) (filter #(and (contains? (::pcp/expects %) attr) @@ -507,8 +507,8 @@ (map #(pcp/get-node graph %)) (filter #(contains? (::pcp/expects %) attr)) first)] - (if (::pcp/run-or missed-parent-node) - (input-missing-detail-OR env missed-parent-node attr) + (if (pcp/branch-node? missed-parent-node) + (input-missing-detail-branch-node env missed-parent-node attr) (input-missing-error-message env missed-parent-node attr)) (str "Can't find parent node that should provide attribute " attr ", this is likely a bug in Pathom, please report it."))) diff --git a/test/com/wsscode/pathom3/connect/runner_test.cljc b/test/com/wsscode/pathom3/connect/runner_test.cljc index b7df15d6..680cafe5 100644 --- a/test/com/wsscode/pathom3/connect/runner_test.cljc +++ b/test/com/wsscode/pathom3/connect/runner_test.cljc @@ -966,32 +966,31 @@ :ex/data {::pcr/attributes-missing {:c {}}}})) (testing "missed attribute comes from AND node" - (comment - (check-all-runners-ex - (pci/register - [(pco/resolver 'a - {::pco/output [:a]} - (fn [_ _] - {})) + (check-all-runners-ex + (pci/register + [(pco/resolver 'a + {::pco/output [:a]} + (fn [_ _] + {})) - (pco/resolver 'b - {::pco/output [:b]} - (fn [_ _] - {})) + (pco/resolver 'b + {::pco/output [:b]} + (fn [_ _] + {})) - (pco/resolver 'c - {::pco/input [:a :b] - ::pco/output [:c]} - (fn [_ _] - {}))]) - {} - [:c] - {:ex/message (str - "Required attributes missing:\n" - "- Attribute :c was expected to be returned from resolver c but inputs were missing:\n" - " - Attribute :a was expected to be returned from resolver a but it failed to provide it.\n" - " - Attribute :b was expected to be returned from resolver b but it failed to provide it.") - :ex/data {::pcr/attributes-missing {:c {}}}}))))) + (pco/resolver 'c + {::pco/input [:a :b] + ::pco/output [:c]} + (fn [_ _] + {}))]) + {} + [:c] + {:ex/message (str + "Required attributes missing:\n" + "- Attribute :c was expected to be returned from resolver c but inputs were missing:\n" + " - Attribute :a was expected to be returned from resolver a but it failed to provide it.\n" + " - Attribute :b was expected to be returned from resolver b but it failed to provide it.") + :ex/data {::pcr/attributes-missing {:c {}}}})))) (deftest run-graph!-final-test (testing "map value"