Well first I'd say it's actually more important here that you are reusing the attribute specs for ::fname ::lname etc across front and back.
And second, perhaps you should be breaking out the common parts into a spec you can reuse instead: (s/def ::person-shared-spec (s/keys ::req-un [::fname ::lname])) (s/def ::person-spec (s/merge ::person-shared-spec (s/keys ::req-un [::id]))) (s/def ::person-ui-spec (s/merge ::person-shared-spec (s/keys ::req-un [::channel]))) Or maybe you really want to combine both of these into a single spec: (s/def ::person-spec (s/keys :req-un [(or ::id ::channel) ::fname ::lname])) Or you could potentially use multi-spec, but I doubt you need an open spec for this. We're not going to add anything like dissoc afaik. On Tuesday, July 19, 2016 at 11:54:52 AM UTC-5, Mamun wrote: > > Hi > > Without dissoc in keys, how to avoid duplicate spec between backend and > frontend layer? > > As an example > > I have backend service where I defined spec like this > > (s/def ::person-spec (s/keys ::req-un [::id ::fname ::lname])) > > Here Id is mandatory for some purpose. > > Now application layer I would like to reuse that backend spec but only id. > Look like now it is not possible as there is no dissoc > > As it is application layer > > (s/def ::person-ui-spec (s/merge (s/keys ::req-un [::channel]) > ::person-spec > ) ) > > merge is excellent, as I could reuse exiting spec. But how I dissoc id > from exiting spec. > > Only way is now to do is define again in application layer. > > (s/def ::person-ui-spec (s/keys ::req-un [::channel ::fname ::lname])) > > > Do you consider dissoc in spec for keys? > > > > Br, > Mamun > bnp paribas groups > > > > > > > > > > > > > -- 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.