Fork me on GitHub
#malli
<
2020-10-07
>
steveb8n00:10:18

Q: is there a typo in the readme in the custom registry section? :post-int

steveb8n00:10:39

Another one: is m/s-simple-schema a typo? This fn doesn’t exit

ikitommi04:10:22

welcome @kari.marttila! first one definitely a typo, could not find the latter. But PR welcome to fix any typos.

steveb8n04:10:24

ok. I’ll make a PR for both

steveb8n04:10:00

scratch that. I don’t know what you would use to replace the second one. I’ll PR for the typo

steveb8n04:10:23

here’s the second one…

Custom registry
Example to create a custom registry without the default core predicates and with :bool and :pos-int Schemas:

(def registry
  (merge
    (m/class-schemas)
    (m/comparator-schemas)
    (m/base-schemas)
    {:bool (m/-simple-schema {:type :bool, :pred boolean?})
     :pos-int (m/-simple-schema {:type :pos-int, :pred pos-int?})}))

(m/validate [:or :bool :pos-int] 'kikka {:registry registry})
; => false

(m/validate [:or :bool :post-int] 123 {:registry registry})
; => true

steveb8n04:10:07

m/-simple-schema doesn’t exist as a fn. I’m not sure what you would use instead

ikitommi05:10:19

are you using the latest version?

steveb8n05:10:18

ah, no. I’m not. sorry. my mistake

ikitommi12:10:05

ok, plan is to ship 0.1.0 tomorrow. going to clean up some internals and polish some docs, but anything relevant missing? the GraalVM tests? https://github.com/metosin/malli/pull/272

🎉 12
ikitommi12:10:35

also, removing :list as it’s not very useful, right?

steveb8n07:10:16

I haven’t used it fwiw

👌 3