(defschema Pilot {name age [optional ]}) (defn greet [] [{name } => ] (str "Hello " name)) {bare [(schemas/valid? "Ada") (schemas/valid? "Ada") (schemas/valid? 1)] field [(schemas/valid? {name } {name "Ada"}) (schemas/valid? {name } {name "Ada"}) (schemas/valid? {name } {name 1})] simplified (schemas/simplify {name nick }) group [(schemas/valid? {age } {age 4}) (schemas/valid? {age } {age 3}) (schemas/valid? {age } {age 4}) (schemas/valid? {age } {age 4.0})] group-simplified (schemas/simplify ) negated [(schemas/valid? {nick } {nick "Usul"}) (schemas/valid? {nick } {nick null}) (schemas/valid? {nick } {})] negated-simplified (schemas/simplify ) nested [(schemas/valid? {pilot {age }} {pilot {age 23}}) (schemas/valid? {pilot {age }} {pilot {age "23"}})] positions [(schemas/valid? [ ] [1 "a"]) (schemas/valid? [... ] [1 2 "a"]) (schemas/valid? [map-of ] {a 1}) (schemas/valid? [maybe ] null) (schemas/valid? [count ] [1 2]) (schemas/valid? [not ] 1) (schemas/valid? {nick [optional ]} {})] mixed [(schemas/valid? { name } {active true name "Ada"}) (schemas/valid? { name } {active false name "Ada"})] true-field [(schemas/valid? {active [is = true]} {active true}) (schemas/valid? {active [is = true]} {active false})] error-payload [(schemas/valid? [error ] (/ 1 0)) (schemas/valid? [error ] (+ 1 "a")) (schemas/valid? [error ] (schemas/valid? 1)) (schemas/valid? [error { message string?}] (schemas/valid? 1))] shared-payload (let [division number ] [(schemas/valid? [join number [error division]] (/ 1 0)) (schemas/valid? [join number [error number]] 3) (schemas/valid? [join number [error number]] "3")]) unknown (schemas/valid? 1) unknown-negated (schemas/valid? 1) unknown-field (schemas/valid? {name } {name "Ada"}) unknown-group (schemas/valid? 1) no-active (schemas/valid? {active true}) builtins-only (let [active? (fn [value] true)] (schemas/valid? 1)) explain (schemas/explain {name age } {name 1 age 3}) meet (schemas/meet ) materialize (schemas/materialize {name [meet [default "Ada"]] nick [optional ]}) fakerize (let [a (random/seeded 7) b (random/seeded 7) value (schemas/fakerize a {age name })] [value (= value (schemas/fakerize b {age int? name string?}))]) match (map (fn [value] (schemas/match value ({name [bind n ]} n) (any "none"))) [{name "Ada"} {name 1}]) definition [(schemas/valid? Pilot {name "Ada" age 3}) (schemas/valid? Pilot {name "Ada" age 3.0}) (schemas/valid? Pilot {name 1})] contract [(greet {name "Ada"}) (greet {name 1})] contract-error (let [safe (fn [x] [ => ] (/ x 0))] (errors/message (safe 1))) callable (let [wide ((fn [callback] [ => [ => ]] callback) (fn [value] 1)) apply-one (fn [f] [[ => ] => ] (f 1))] [(schemas/valid? [int? => number?] wide) (schemas/valid? [ => ] wide) (schemas/valid? [ => ] wide) (apply-one (fn [x] (+ x 1))) (apply-one (fn [x] "one"))])}