Fork me on GitHub
#clojure-spec
<
2017-03-12
>
dottedmag18:03:42

I am trying to use spec to validate/destructure external data (JSON). This data reuses key names throughout the various entities: there are keys named N in various parts of data meaning "name", "route number" and "allowed number of things", and they should have different specifications. How do I specify that in spec?

dottedmag18:03:17

I can do it via :req-un in separate namespaces, but I'm not thrilled by the necessity to create ~15 namespaces, one for every entity kind.

yonatanel18:03:29

@dottedmag You don't have to actually create the namespace, just fully qualify the specs (unless you want to alias namespaces, but you don't have to)