Fork me on GitHub
#clojure-spec
<
2018-11-27
>
richiardiandrea00:11:41

hello folks, it there a predicate for non-nil? I want to make sure that the key is there but it is not nil and I don't care about the value - can't use any? basically

taylor00:11:27

does some? work?

richiardiandrea00:11:11

thank you @taylor forgot about that one 🙂

🤝 4
taylor00:11:38

just checking it out locally b/c I’ve never tried using some? for a spec:

(gen/sample (s/gen some?))
=> (() #{} . {} \8 {} {} [] [y5/S? false 5] :k-)

urzds15:11:50

Is there a way to separate the spec of the structure of a data structure from the spec of the data, and allow different "models" to be used in different circumstances? I.e. have a :usergroup {::meetingpoint {...} ::users [{::address ... ::name ...} ...]} (with (s/def ::users (s/* ::user)) for the geo routing part of my application, but ::user {::email ... ::name ...} for the messaging part of my application, but let both parts share the non-structural specs of ::user's data? I.e. can I tell spec "validate this map with structural information X ... switch to a different component of my app ... now validate the same map with structural information Y", with both X and Y using the same leafs and the map being the same, using the same keywords as keys, just the structure being different? (Following up on @stijn's question from earlier and my own discussion with @orestis in #graphql.)