def _validate_unique(self, unique, field, value):
        """Ensure value uniqueness.

        The rule's arguments are validated against this schema:
        {'type': 'boolean'}
        """
        if unique:
            root_key = self.schema_path[0]
            data = (doc[field] for doc in self.root_document[root_key])
            for key, count in collections.Counter(data).items():
                if count > 1:
                    msg = "'{}' is not unique".format(key)
                    self._error(field, msg)
def _validate_unique ( self , unique , field , value ) : if unique : root_key = self . schema_path [ 0 ] data = ( doc [ field ] for doc in self . root_document [ root_key ] ) for key , count in collections . Counter ( data ) . items ( ) : if count > 1 : msg = "'{}' is not unique" . format ( key ) self . _error ( field , msg )
Ensure value uniqueness.

        The rule's arguments are validated against this schema:
        {'type': 'boolean'}