This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-22
Channels
- # aleph (5)
- # announcements (9)
- # babashka (9)
- # beginners (127)
- # cherry (1)
- # cider (48)
- # clj-kondo (5)
- # cljdoc (1)
- # clojure (70)
- # clojure-berlin (1)
- # clojure-europe (57)
- # clojure-france (2)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-norway (4)
- # clojure-uk (1)
- # clojurescript (2)
- # css (1)
- # cursive (6)
- # emacs (6)
- # gratitude (1)
- # honeysql (5)
- # introduce-yourself (5)
- # jobs-discuss (7)
- # joyride (1)
- # kaocha (3)
- # lsp (1)
- # malli (9)
- # nbb (2)
- # off-topic (91)
- # pathom (7)
- # pedestal (14)
- # re-frame (4)
- # reitit (67)
- # shadow-cljs (46)
- # spacemacs (3)
- # squint (3)
- # tools-build (14)
- # tools-deps (1)
- # vim (3)
What is the best way to tell if a given string is a valid malli schema? As I understand it this is a two-step process... first I need to determine if it's valid edn data and in a second step I have to determine if it's a valid malli schema. There is a schema called "`:schema` " in malli.core/base-schemas
, but how do I use it properly?
Well the idea is that the user provides a schema definition and I want to check if it's a valid malli schema, so something like "[:cat :int]", anything that can be turned into a schema with m/schema in the current context should be valid, everthing else I'd like to give proper error messages on.
I'd like to humanize the output of "trying to use the input as a malli schema".
without humanizing:
(malli.edn/read-string "[:enum :kikka :kukka]")
; => [:enum :kikka :kukka]
(malli.edn/read-string "[:enumz :kikka :kukka]")
; =throws=> :malli.core/invalid-schema {:schema :enumz}
Yea, but is there a meta-schema for a malli schema? I thought it was maybe malli.core/base-schema/:schema
It's got to be something that me/read-string does under the hood.
there is no Malli Schema for Malli Schemas. There is support for it (each schema can define it's supported properties & schema for children), but no-one has had time to actually describe those.
Okay good to know, thanks! 🙂