Fork me on GitHub
#clojure-spec
<
2019-02-24
>
eoliphant21:02:20

Hi, trying to muddle through a modeling scenario in the context of spec. In one of my domains I work with grants. so a grant has a unique :grant/number that’s a string of some format “GRT-999”, etc., string? + regex and I’m good. But i also have to deal with the fact that various ‘issuers’ of grant’s have their own formats. Issuer A, uses “GRANT-999", B uses “G_999”,etc. So, I’m grappling with somehow providing ‘context’ to the spec. Or are these better modeled as different things entirely :issuer-a/grant-number, :issuer-b/grant-number?

borkdude21:02:22

I can imagine that a grant has a :grant/issuer and based on that value you can verify if the :grant/number is valid, possibly using s/and or maybe using a multi-spec?