yada

lwhorton 2018-12-10T18:26:26.011400Z

this might be a plumatic/schema question and not yada, but how do I represent “all or nothing for these query params” in a handler?

{:query (sc/maybe {:start-a sc/Inst
  :end-a sc/Inst
 :start-b sc/Inst
 :end-b sc/Inst})}

lwhorton 2018-12-10T20:39:02.012Z

well, i found one way to do it that seems to work with coercers. not pretty but it’s a thing:

(sc/conditional #(and (not (empty? %)) (map? %))
                                                      {:start-a sc/Inst
                                                       :end-a sc/Inst
                                                       :start-b sc/Inst
                                                       :end-b sc/Inst}
                                                      :else
                                                      (sc/pred #(empty? %)))