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

Allow extra keys in schemas #27

Closed ikitommi closed 6 years ago

ikitommi commented 8 years ago

Would be super in conjunction with select-schema:

(s/defschema Abba {:a s/Str, :b {:c s/Str}})

(st/with-extra-keys Abba)
; => {:a s/Str, s/Any s/Any, :b {:c s/Str, s/Any s/Any}}

(st/with-extra-keyword-keys Abba)
; => {:a s/Str, s/Keyword s/Any, :b {:c s/Str, s/Keyword s/Any}}
ikitommi commented 8 years ago

and the reverse functions too:

(st/without-extra-keys {:a s/Str, s/Any s/Any, :b {:c s/Str, s/Keyword s/Any}})
; => {:a s/Str, :b {:c s/Str}}
ikitommi commented 6 years ago

st/open-schema