Fork me on GitHub
#malli
<
2021-07-06
>
emccue03:07:42

Is there a good thing to use for "I make no assumptions about what this is"

emccue03:07:14

like any?, but for say something you can pass to next.jdbc

emccue03:07:40

and won't be generatable

emccue03:07:01

writing a spec for what would count as a "db" has been confusing me, so i want a give up hatch for a second

ikitommi09:07:44

so, :any is not enough? You could say [:any {:gen/elements ["whatever"]}] to generate what you like.

emccue13:07:31

I guess it is with the empty gen elements.

ikitommi12:07:14

miu/collect! with pluggable collector. anyone interested in doing fspec -> malli collector?

ikitommi12:07:38

the source:

(defn -accept-default [v]
  (let [{:keys [ns name malli/schema] :as meta} (meta v)]
    (when schema (m/-register-function-schema! (-> ns str symbol) name (miu/-unlift-keys meta "malli")))))

(defn collect! [{:keys [ns accept] :or {accept -accept-default}}]
  (doseq [[_ v] (ns-publics ns)] (accept v)))

ikitommi12:07:12

Idea: an external tool that infers the schemas from vars and adds the needed schema meta into vars (rewrites the source, I recall there are tools for that already, edamame?).

robert-stuttaford15:07:35

i use edamame on the edn that i give to malli, but only because i have the exceptions edamame gives me to tell the user where they typed something wrong when they malform edn

borkdude22:07:10

> rewrites the source This would be rewrite-clj

👍 2
robert-stuttaford13:07:07

use that too 😄

robert-stuttaford15:07:56

Malli is lovely.

2
☝️ 8
❤️ 6
ikitommi19:07:51

generated responses from function schema definitions:

👏 18
emccue22:07:27

@robert-stuttaford I'll add to that - the malli syntax is solid even without an impl. We don't use malli at work yet, but we have already started using its syntax for describing data in (comment ...) blocks.