traits icon indicating copy to clipboard operation
traits copied to clipboard

TraitList use-case: enforcing uniqueness

Open mdickinson opened this issue 4 years ago • 0 comments

The current TraitList has per-item validation, but no global list validation. In particular, the min-length and max-length validation that was previously available on List traits seemed to add more complication that it was worth.

A use-case that turned up in an actual Traits-using project was enforcing uniqueness of the list contents (that is, ensuring that the list contained no duplicates).

It would be interesting to explore what changes we'd need to make to make that validation easily available to users, either via subclassing TraitList, or via adding a suitable hook within TraitList itself.

mdickinson avatar Jan 12 '21 11:01 mdickinson