Fork me on GitHub
#clojure-spec
<
2021-04-11
>
Braden Shepherdson20:04:07

I'm trying to spec a large, complicated map for a bunch of game data. there are several possible states the game might be in, and the fields vary depending on which state we're in. I want a spec something like (s/def ::state-pregame (s/merge ::state-core (s/keys pregame-specific-things) {::state :states/pregame}))

Braden Shepherdson20:04:22

where the key is that last bit, specifying a particular key and value pair for the pregame state.

Braden Shepherdson20:04:05

oh, TIL about multi-spec, which is exactly this.