Skip to content

Instantly share code, notes, and snippets.

@konr
Created November 20, 2013 13:53
Show Gist options
  • Save konr/7563516 to your computer and use it in GitHub Desktop.
Save konr/7563516 to your computer and use it in GitHub Desktop.
skeletons example
(def skeleton
{:fullname {:required true
:as [:account-request :name]
:eg "Konrad Scorciapino"}
:email {:required true
:as [:account-request :email]
:eg "konrad@eo2.com.br"
:validator v/validate-email}
:id {:as [:meta :id]
:eg "06965086-c44b-4395-a435-dc7c20a10757"
:transform str-to-uuid :transform-back str}})
(def in {:fullname "Konrad" :email "konr@konr.mobi" :id "06965086-c44b-4395-a435-dc7c20a10757"})
(transform skeleton in)
;; => {:validated true
;; :data {:account-request {:name "Konrad" :email "konr@konr.mobi"}
;; :meta {:id #uuid "06965086-c44b-4395-a435-dc7c20a10757"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment