Fork me on GitHub
#clojure-spec
<
2019-11-08
>
pablore00:11:15

what are the main differences between spec 2 and alpha?

kszabo00:11:04

mainly how they handle aggregates of attributes. You only specify required/optional attributes at the context of the usage site

👍 8
kszabo00:11:48

‘bags’ of attributes are now the primary way of mapping domain entities in spec2, they don’t talk about requirements

kszabo00:11:05

also some programmatic convenience improvements

kszabo00:11:09

of course I am oversimplifying

wilkerlucio16:11:52

hello, with spec1, I'm having issues to define a spec that is not loaded, I get Unable to resolve spec: ..., consider this is file B, the spec in question is defined by A, but A requires B, so I can't load A before loading B (circular reference), with that constraint, is there a way to tell spec to ignore that the spec is not defined at that time?

Alex Miller (Clojure team)16:11:37

most spec types delay resolving references so don't run into this, but there are a few that don't

Alex Miller (Clojure team)16:11:58

for those that don't, you'll need to break that cycle somehow

wilkerlucio16:11:46

thanks, I got rid of the cycle by moving those spec definitions to a new namespace (since I we can define things from other namespaces, so still have the same name, just defined in a different file)

didibus21:11:53

What's the best way to restrict a string to a min/max length, so that the generator still works for it ?

Alex Miller (Clojure team)21:11:58

I don't think there is a general way to do that without writing a generator

Alex Miller (Clojure team)21:11:20

(and to do that, I would generate strings of length up to (max-min) and a string of length min, then concat)

didibus21:11:48

Hum, alright, I'll use a custom generator then