Created
November 20, 2013 13:53
-
-
Save konr/7563516 to your computer and use it in GitHub Desktop.
skeletons example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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