We use Break Versioning. The version numbers follow a <major>.<minor>.<patch>
scheme with the following intent:
Bump | Intent |
---|---|
major | Major breaking changes -- check the changelog for details. |
minor | Minor breaking changes -- check the changelog for details. |
patch | No breaking changes, ever!! |
-SNAPSHOT
versions are preview versions for upcoming releases.
Malli is in alpha.
;; 3.0µs => 1.1µs
(bench (m/schema [:or :int :string]))
(def ?schema
[:map
[:x boolean?]
[:y {:optional true} int?]
[:z [:map
[:x boolean?]
[:y {:optional true} int?]]]])
;; 44µs -> 8.5µs
(bench (m/schema ?schema))
;; 26µs -> 1.3µs
(bench (m/walk schema (m/schema-walker identity)))
;; 51µs -> 6.5µs
(bench (mu/closed-schema schema))
m/function-schema
mvxcvi/arrangement
to make pretty printing work:or
, :and
, :orn
and :map
, thanks to Ben Sless:;; 164ns -> 28ns
(let [valid? (m/validator [:and [:> 0] [:> 1] [:> 2] [:> 3] [:> 4]])]
(cc/quick-bench (valid? 5)))
;; 150ns -> 30ns
(let [valid? (m/validator [:map [:a :any] [:b :any] [:c :any] [:d :any] [:e :any]])
value {:a 1, :b 2, :c 3, :d 4, :e 5}]
(cc/quick-bench (valid? value)))
(let [decode (m/decoder
[:map
[:id :string]
[:type :keyword]
[:address
[:map
[:street :string]
[:lonlat [:tuple :double :double]]]]]
(mt/json-transformer))
json {:id "pulla"
:type "food"
:address {:street "hämeenkatu 14"
:lonlat [61 23.7644223]}}]
;; 920ns => 160ns
(cc/quick-bench
(decode json)))
BREAKING: malli.json-schema/unlift-keys
is removed in favor of malli.core/-unlift-keys
BREAKING: malli.json-schema/unlift
is removed in favor of get
BREAKING: malli.provider/stats
is removed (was already deprecated)
BREAKING: malli.util/update
doesn't the properties of the key it updates, fixes #412
BREAKING: New rules for humanized errors, see #502, fixes #80, #428 and #499.
new malli.instrument
and malli.dev
for instrumenting function Vars (e.g. defn
s), see the guide.
new malli.plantuml
namespace for PlantUML generation
new malli.generator/check
for generative testing of functions and defn
s.
new malli.core/parent
:map-of
supports :min
and :max
properties
Collection Schemas emit correct JSON Schema min & max declarations
humanized errors for :boolean
& :malli.core/tuple-limit
predicate schema for fn?
malli.util/transform-entries
passes in options [#340]/(https://github.com/metosin/malli/pull/340)
BETA: humanized errors can be read from parent schemas (also from map entries), fixes #86:
(-> [:map
[:foo {:error/message "entry-failure"} :int]]
(m/explain {:foo "1"})
(me/humanize {:resolve me/-resolve-root-error}))
; => {:foo ["entry-failure"]}
malli.util.impl/-fail!
is now malli.core/-fail!
malli.core/-unlift-keys
malli.core/-instrument
malli.core/-register-function-schema!
is now 4-arity, new argument is data mapmalli.core/-fail!
has only arity 1 & 2 versionsifn?
predicate, #416m/-explain
with :function
and :=>
Schemasm/properties-schema
and m/children-schema
to resolve Malli Schemas for IntoSchema
s. Empty implementations.:gen/schema
property for declarative generation, e.g. [:string {:gen/schema :int, :gen/fmap str}]
-type
is moved from Schema
to IntoSchema
.-type-properties
is moved from Schema
to IntoSchema
.IntoSchema
Protocol
(-properties-schema [this options] "maybe returns :map schema describing schema properties")
(-children-schema [this options] "maybe returns sequence schema describing schema children")
:nil
schema, #401:multi
returns branch information, #403:and
merges using first child, #405:orn
json-schema & generator, #400mt/default-value-transformer
, #397nil
keys in maps, #392:m/default
for :multi
, #391:double
, #382support for sequence schemas: :cat
, catn
, alt
, altn
, :?
, :*
, :+
and repeat
, see Sequence Schemas.
support for parsing and unparsing schemas: m/parse
, m/parser
, m/unparse
, m/unparser
, see Parsing values.
support for function schmas: :=>
and :function
, see Function Schemas.
new schemas: :any
(e.g. any?
), :not
(complement) and :orn
(or with named branches)
:qualified-keyword
support :namespace
property
FIX: Schema vizualization is not working for [:< ...]
like schemas, #370
Ensure we use size 30 for generator (for more variety), #364
Set JSON Schema types and formats for numbers properly #354
-memoize actually memoized. easily 100x faster now #350
Fix interceptor composition, #347
malli.util
: add a rename-keys utility, similar to clojure.set #338
Let mu/update
accept plain data schemas, #329
mu/find
, #322
m/Schema
has new methods: -parent
, -parser
and -unparser
m/-coder
and m/-chain
are replaced wih m/-intercepting
m/-fail!
is now miu/-fail!
m/-error
is now miu/-error
:sequential
decoding with empty sequence under mt/json-transformer
, fixes #288
mt/-sequential->seq
m/deref
returns original schema, does not throw, fixes #284.malli.util
deref top-level refs recursively: merge
, union
, transform-entries
, optional-keys
, required-keys
, select-keys
and dissoc
.m/deref-all
derefs all top-level references recursively, e.g.(m/deref-all [:schema [:schema int?]])
; => int?
:ref
, :schema
, ::m/schema
have now generators, JSON Schema and Swagger supportmu/subschemas
walks over top-level :ref
and all :schema
s.m/walk
can walk over :ref
and :schema
reference schemas. Walking can be enabled using options :malli.core/walk-refs
and :malli.core/walk-schema-refs
.There are also declarative versions of schema transforming utilities in malli.util/schemas
. These include :merge
, :union
and :select-keys
:
(def registry (merge (m/default-schemas) (mu/schemas)))
(def Merged
(m/schema
[:merge
[:map [:x :string]]
[:map [:y :int]]]
{:registry registry}))
Merged
;[:merge
; [:map [:x :string]]
; [:map [:y :int]]]
(m/deref Merged)
;[:map
; [:x :string]
; [:y :int]]
(m/validate Merged {:x "kikka", :y 6})
; => true
New options for SCI:
:malli.core/disable-sci
for explicitly disabling sci
, fixes #276:malli.core/sci-options
for configuring sci
malli.transform/default-value-transformer
accepts options :key
and :defaults
:
(m/decode
[:map
[:user [:map
[:name :string]
[:description {:ui/default "-"} :string]]]]
nil
(mt/default-value-transformer
{:key :ui/default
:defaults {:map (constantly {})
:string (constantly "")}}))
; => {:user {:name "", :description "-"}}
First stable release.
:list
schemamalli.error/SchemaError
protocol in favor of using m/type-properties
for custom errorsm/-predicate-schema
, m/-partial-predicate-schema
and m/-leaf-schema
m/Schema
: -type-properties
m/children
returns 3-tuple (key, properties, schema) for MapSchema
sm/map-entries
is removed, m/entries
returns a MapEntry
of key & m/-val-schema
:path
in explain is re-implemented: map keys by value, others by child indexm/-walk
and m/Walker
uses :path
, not :in
m/-outer
has new parameter order: walker schema path children options
malli.util/path-schemas
replaced with malli.util/subschemas
& malli.util/distict-by
LensSchema
has a new -key
methodmalli.core
& malli.util
malli.core
to malli.util
com.gfredericks/test.chuck
sci
is not a default dependency. Enabling sci-support:
borkdude/sci
sci.core
(directly or via :preloads
)malli.transform
internals.malli.mermaid
is removed (in favor of malli.dot
)[metosin/malli "0.0.1-20200710.075225-19"]
m/accept
-> m/walk
m/schema-visitor
-> m/schema-walker
m/map-syntax-visitor
-> m/map-syntax-walker
-children
method in Schema
, to return child schemas as instances (instead of just AST)malli.core/*-registry
defs into malli.core/*-schemas
defns to enable DCE for clojurescriptmalli.core/name
& malli.core/-name
renamed to malli.core/type
& malli.core/-type
malli.generator/-generator
is renamed to malli.generator/-schema-generator
Can you improve this documentation? These fine people already did:
Tommi Reiman, Miikka Koskinen, James Conroy-Finn & Lucy WangEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close