Fork me on GitHub

"I'm looking at the ring-malli-lite-swagger and ring-malli-swagger of reitit and the differences in the server.clj are just in the syntax. So it looks like reitit recognizes the lite syntax without configuration. It's very nice that we can use assoc/dissoc/merge in plain Clojure and reduce clutter."


How would you write a function schema for (defn foo [a & {:keys [b c}] ...) ?


You could use malli.destructure to infer a schema.

user=> (require '[malli.destructure :as md])
user=> (defn foo [a & {:keys [b c]}])
user=> (md/infer #'foo)
[:=> [:cat :any [:altn [:map [:map [:b {:optional true} :any] [:c {:optional true} :any]]] [:args [:* [:alt [:cat [:= :b] :any] [:cat [:= :c] :any] [:cat :any :any]]]]]] :any]


Great thanks, didn’t remember that one

Bart Kleijngeld17:02:21

Does someone know if there's a way to have :malli/schema metadata on functions be rendered into documentation by Codox?

Bart Kleijngeld17:02:33

So the function schema would be visible in the docs for that function. Even a plain text dump would be nice.

Ben Sless17:02:42

You could probably do it in codox by configuring which metadata it looks at

Bart Kleijngeld17:02:23

Yeah you're probably right. And I expect whatever theme I'll be using must also be extended to show that metadata.


If you need to produce strings / explainations there’s malli.experimental.describe/describe too!


We are using that to generate some simple docs ^

Bart Kleijngeld19:02:25

That may come in handy, thanks :)


has any progress been made on this front?

Benjamin19:02:35 is there tool that generates malli from json schema and would this be useful? I was doing something with google docs api in the past and it might have been mildly useful

Noah Bogart19:02:40

There's about it, along with this Maybe you or someone else could pick it up and finish it? I'd also love to have this functionality but my job only allows me enough time to fix a bug here or there.

Ben Sless19:02:54

There's also a gist I shared some time ago in malli, need to dig it up