What would be the best way to do something like the following to declare the argument schema of fn3 as the merged map of the schemas of the functions it calls without manually rewriting the schema:
(def fn1
{:malli/schema [:-> [:map [:user User]] :any]}
[{:keys [user]}]
user)
(def fn2
{:malli/schema [:-> [:map [:org Org]] :any]}
[{:keys [org]}]
org)
(defn fn3
{:malli/schema [:-> [#_"THE MERGED MAP OF fn1 ARGS AND fn2 ARGS"] :any]}
[{:keys [user org]}]
(str (fn1 user) (fn2 org)))I would even be happy if I could do something like this where I define the keys of the map passed to fn3 but the values for those keys are derived from the user and org of fn1 and fn2 respectively:
(defn fn3
{:malli/schema [:-> [:map [:user #_"THE USER FROM fn1" :org #_"THE ORG FROM fn2" ]] :any]}
[{:keys [user org]}]
(str (fn1 user) (fn2 org)))I guess I could create a Fn1User schema and just share it between the two but I was kind of hoping to do it programmatically.
Thinking about it a bit more, creating a separate schema and sharing it is probably the better option.