reifyhealth / specmonstah

Specmonstah will eat the face off your test fixtures
MIT License
359 stars 18 forks source link

Is a combination of :uniq and :coll allowed in constraints? #52

Closed keerts closed 5 years ago

keerts commented 5 years ago

Is a combination of :uniq and :coll allowed in constraints?

Is this something that could work:

(def schema2
  {:contact {:prefix      :contact
             :spec        ::contact}
   :company {:prefix :company
             :spec ::company
             :relations   {:employs [:contact :id]}
             :constraints {:employs #{:uniq :coll}}}})

It seems it does not force new ents when used with a query like: {:company [[1 {:refs {:employs 2}}]]}

flyingmachine commented 5 years ago

I want to look into this a little more, but I'm pretty sure you don't need to :uniq if you have :coll. Hope this helps!