规范记录和地图的更简洁的方式?

less verbose ways of spec'ing records and maps?

是否有比官方规范指南中的方式更简洁的方式来制作地图或记录的规范?

(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]))

这是Clojure团队的有意识的决定to have values and key sets spec'ed separately (you can read this discussion for a longer explanation). What you suggest is considered an anti-pattern in clojure.spec and was deliberately made not possible

如果你想要 single-statement 嵌套结构规范,最好使用 Plumatic Schema