def validate_type()

in pulsar/schema/definition.py [0:0]


    def validate_type(self, name, val):
        t = type(val)

        if val is None and not self._required:
            return self.default()

        if not (isinstance(val, (str, bytes)) or t.__name__ == 'unicode'):
            raise TypeError("Invalid type '%s' for field '%s'. Expected a string" % (t, name))
        if isinstance(val, bytes):
            return val.decode()
        return val