2017-02-05 19 views
1

製作地圖或記錄規格的方式與官方規格指南中的方式相比,有沒有更詳細的方法?詳細的spec'ing記錄和地圖的方式?

(defrecord Person [first-name last-name email phone]) 
(s/def ::first-name string?) 
(s/def ::last-name string?) 
(s/def ::email ::email-type) 
(s/def ::person (s/keys :req-un [::first-name ::last-name ::email] 
         :opt-un [::phone])) 

理想這將是很好,如果我可以只寫類似

(defrecord Person [first-name last-name email phone]) 
(s/def ::person (s/keys :req-un [:first-name string? 
           :last-name string? 
           :email ::email-type] 
         :opt-un [:phone])) 

回答