metosin / schema-tools

Clojure(Script) tools for Plumatic Schema
http://metosin.github.io/schema-tools/
Eclipse Public License 2.0
107 stars 16 forks source link

Creating values based of Schema definitions #9

Closed ikitommi closed 6 years ago

ikitommi commented 9 years ago

Given a Schema (& generator), a can create valid schema values. Two default generators, empty-values, random-values (via clojure.test.check.generators?):

(s/defschema Order {:id s/Str, :name (s/maybe s/Str), (s/optional-key :description) s/Str, :rows [{:title s/Str}]})

(generate Order empty-values)
; => {:id "", :name nil, :rows []}
ikitommi commented 9 years ago

http://blog.getprismatic.com/schema-1-0-released/