How to use the cerberus.errors.DOCUMENT_FORMAT.format function in Cerberus

To help you get started, we’ve selected a few Cerberus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pypa / pipenv / pipenv / vendor / cerberus / validator.py View on Github external
self.schema_error_tree = errors.SchemaErrorTree()
        self.document = copy(document)
        if not self.is_child:
            self._is_normalized = False

        if schema is not None:
            self.schema = DefinitionSchema(self, schema)
        elif self.schema is None:
            if isinstance(self.allow_unknown, Mapping):
                self._schema = {}
            else:
                raise SchemaError(errors.SCHEMA_ERROR_MISSING)
        if document is None:
            raise DocumentError(errors.DOCUMENT_MISSING)
        if not isinstance(document, Mapping):
            raise DocumentError(errors.DOCUMENT_FORMAT.format(document))
        self.error_handler.start(self)
github pyeve / cerberus / cerberus / base.py View on Github external
self.document = copy(document)
        if not self.is_child:
            self._is_normalized = False

        self.__init_schema(schema)

        if self.schema is None:
            if isinstance(self.allow_unknown, Mapping):
                self.schema = {}
            else:
                raise SchemaError(errors.MISSING_SCHEMA)

        if document is None:
            raise DocumentError(errors.DOCUMENT_MISSING)
        if not isinstance(document, Mapping):
            raise DocumentError(errors.DOCUMENT_FORMAT.format(document))
        self.error_handler.start(self)