Changing these two lines works, but I don't know whether it would cause other issues
``` (defmulti event-type :type) (s/def :event/event (s/multi-spec event-type :type)) ``` On Monday, October 3, 2016 at 4:01:32 AM UTC-7, Karol Hosiawa wrote: > > I don't know how to define multi-spec so that it works with unqualified > keys and generators. > > An example from the official guide: > > https://clojure.org/guides/spec#_multi_spec > > > (s/def :event/type keyword?) > (s/def :event/timestamp int?) > (s/def :search/url string?) > (s/def :error/message string?) > (s/def :error/code int?) > > (defmulti event-type :event/type) > (defmethod event-type :event/search [_] > (s/keys :req-un [:event/type :event/timestamp :search/url])) > (defmethod event-type :event/error [_] > (s/keys :req-un [:event/type :event/timestamp :error/message > :error/code])) > > (s/def :event/event (s/multi-spec event-type :event/type)) > > > I changed :req to :req-un > > Now when I try to generate some data: > > (s/exercise :event/event 1) > > I get both :type and :event/type keys: > > ([{:type :V, :timestamp -1, :message "", :code -1, :event/type > :event/error} > {:type :V, :timestamp -1, :message "", :code -1, :event/type > :event/error}]) > > I'd like to have only the unqualified :type key in there. > > What am I missing ? > > Any help much appreciated. > Karol > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.