malli

https://github.com/metosin/malli :malli:
fmn 2021-03-15T06:28:29.386300Z

Currently, is it possible to do this with parse ?

(s/def ::name-or-id (s/or :name string?
                          :id   int?))
(s/conform ::name-or-id "abc")
;;=> [:name "abc"]
(s/conform ::name-or-id 100)
;;=> [:id 100]

ikitommi 2021-03-15T08:09:09.388400Z

@funyako.funyao156 try [:orn [:name string?] [:id int?]]. There are named-branch variants for :or, :alt and :cat with +n in the name.

fmn 2021-03-15T11:06:45.388600Z

@ikitommi Thanks!