Module licenseware.history.history_schemas
Expand source code
from marshmallow import Schema, fields
from licenseware.common.validators import validate_uuid4
class FileNameValidationSchema(Schema):
status = fields.String()
filename = fields.String()
message = fields.String()
class FileContentValidationSchema(Schema):
status = fields.String()
filename = fields.String()
filepath = fields.String()
message = fields.String()
class ProcessingDetailsSchema(Schema):
step = fields.String(required=True)
filepath = fields.String(required=True)
status = fields.String(required=True)
# Permisive on_success_save and on_failure_save
success = fields.Raw(required=False, allow_none=True)
error = fields.Raw(required=False, allow_none=True)
traceback = fields.String(required=False, allow_none=True)
callable = fields.String(required=False, allow_none=True)
source = fields.String(required=False, allow_none=True)
updated_at = fields.String(required=True)
file_name = fields.String(required=True)
class HistorySchema(Schema):
tenant_id = fields.String(required=True, validate=validate_uuid4)
event_id = fields.String(required=True, validate=validate_uuid4)
app_id = fields.String(required=True)
uploader_id = fields.String(required=True)
filename_validation = fields.List(fields.Nested(FileNameValidationSchema))
file_content_validation = fields.List(fields.Nested(FileContentValidationSchema))
files_uploaded = fields.List(fields.String)
processing_details = fields.List(fields.Nested(ProcessingDetailsSchema), allow_none=True)
updated_at = fields.String()
filename_validation_updated_at = fields.String()
file_content_validation_updated_at = fields.String()
class EntitiesSchema(Schema):
entities = fields.List(fields.Raw, required=True)
Classes
class EntitiesSchema (*, only: Union[Sequence[str], Set[str], None] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Optional[Dict[~KT, ~VT]] = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: Optional[str] = None)-
Base schema class with which to define custom schemas.
Example usage:
.. code-block:: python
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}:param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both
onlyandexclude, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set toTrueifobjis a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:fields.Methodand :class:fields.Functionfields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down toNestedfields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. UseEXCLUDE,INCLUDEorRAISE.Changed in version: 3.0.0
prefixparameter removed.Changed in version: 2.0.0
__validators__,__preprocessors__, and__data_handlers__are removed in favor ofmarshmallow.decorators.validates_schema,marshmallow.decorators.pre_loadandmarshmallow.decorators.post_dump.__accessor__and__error_handler__are deprecated. Implement thehandle_errorandget_attributemethods instead.Expand source code
class EntitiesSchema(Schema): entities = fields.List(fields.Raw, required=True)Ancestors
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
var entitiesvar opts
class FileContentValidationSchema (*, only: Union[Sequence[str], Set[str], None] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Optional[Dict[~KT, ~VT]] = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: Optional[str] = None)-
Base schema class with which to define custom schemas.
Example usage:
.. code-block:: python
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}:param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both
onlyandexclude, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set toTrueifobjis a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:fields.Methodand :class:fields.Functionfields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down toNestedfields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. UseEXCLUDE,INCLUDEorRAISE.Changed in version: 3.0.0
prefixparameter removed.Changed in version: 2.0.0
__validators__,__preprocessors__, and__data_handlers__are removed in favor ofmarshmallow.decorators.validates_schema,marshmallow.decorators.pre_loadandmarshmallow.decorators.post_dump.__accessor__and__error_handler__are deprecated. Implement thehandle_errorandget_attributemethods instead.Expand source code
class FileContentValidationSchema(Schema): status = fields.String() filename = fields.String() filepath = fields.String() message = fields.String()Ancestors
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
var filenamevar filepathvar messagevar optsvar status
class FileNameValidationSchema (*, only: Union[Sequence[str], Set[str], None] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Optional[Dict[~KT, ~VT]] = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: Optional[str] = None)-
Base schema class with which to define custom schemas.
Example usage:
.. code-block:: python
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}:param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both
onlyandexclude, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set toTrueifobjis a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:fields.Methodand :class:fields.Functionfields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down toNestedfields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. UseEXCLUDE,INCLUDEorRAISE.Changed in version: 3.0.0
prefixparameter removed.Changed in version: 2.0.0
__validators__,__preprocessors__, and__data_handlers__are removed in favor ofmarshmallow.decorators.validates_schema,marshmallow.decorators.pre_loadandmarshmallow.decorators.post_dump.__accessor__and__error_handler__are deprecated. Implement thehandle_errorandget_attributemethods instead.Expand source code
class FileNameValidationSchema(Schema): status = fields.String() filename = fields.String() message = fields.String()Ancestors
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
var filenamevar messagevar optsvar status
class HistorySchema (*, only: Union[Sequence[str], Set[str], None] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Optional[Dict[~KT, ~VT]] = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: Optional[str] = None)-
Base schema class with which to define custom schemas.
Example usage:
.. code-block:: python
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}:param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both
onlyandexclude, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set toTrueifobjis a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:fields.Methodand :class:fields.Functionfields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down toNestedfields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. UseEXCLUDE,INCLUDEorRAISE.Changed in version: 3.0.0
prefixparameter removed.Changed in version: 2.0.0
__validators__,__preprocessors__, and__data_handlers__are removed in favor ofmarshmallow.decorators.validates_schema,marshmallow.decorators.pre_loadandmarshmallow.decorators.post_dump.__accessor__and__error_handler__are deprecated. Implement thehandle_errorandget_attributemethods instead.Expand source code
class HistorySchema(Schema): tenant_id = fields.String(required=True, validate=validate_uuid4) event_id = fields.String(required=True, validate=validate_uuid4) app_id = fields.String(required=True) uploader_id = fields.String(required=True) filename_validation = fields.List(fields.Nested(FileNameValidationSchema)) file_content_validation = fields.List(fields.Nested(FileContentValidationSchema)) files_uploaded = fields.List(fields.String) processing_details = fields.List(fields.Nested(ProcessingDetailsSchema), allow_none=True) updated_at = fields.String() filename_validation_updated_at = fields.String() file_content_validation_updated_at = fields.String()Ancestors
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
var app_idvar event_idvar file_content_validationvar file_content_validation_updated_atvar filename_validationvar filename_validation_updated_atvar files_uploadedvar optsvar processing_detailsvar tenant_idvar updated_atvar uploader_id
class ProcessingDetailsSchema (*, only: Union[Sequence[str], Set[str], None] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Optional[Dict[~KT, ~VT]] = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: Optional[str] = None)-
Base schema class with which to define custom schemas.
Example usage:
.. code-block:: python
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}:param only: Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters. :param exclude: Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both
onlyandexclude, it is not used. Nested fields can be represented with dot delimiters. :param many: Should be set toTrueifobjis a collection so that the object will be serialized to a list. :param context: Optional context passed to :class:fields.Methodand :class:fields.Functionfields. :param load_only: Fields to skip during serialization (write-only fields) :param dump_only: Fields to skip during deserialization (read-only fields) :param partial: Whether to ignore missing fields and not require any fields declared. Propagates down toNestedfields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields. :param unknown: Whether to exclude, include, or raise an error for unknown fields in the data. UseEXCLUDE,INCLUDEorRAISE.Changed in version: 3.0.0
prefixparameter removed.Changed in version: 2.0.0
__validators__,__preprocessors__, and__data_handlers__are removed in favor ofmarshmallow.decorators.validates_schema,marshmallow.decorators.pre_loadandmarshmallow.decorators.post_dump.__accessor__and__error_handler__are deprecated. Implement thehandle_errorandget_attributemethods instead.Expand source code
class ProcessingDetailsSchema(Schema): step = fields.String(required=True) filepath = fields.String(required=True) status = fields.String(required=True) # Permisive on_success_save and on_failure_save success = fields.Raw(required=False, allow_none=True) error = fields.Raw(required=False, allow_none=True) traceback = fields.String(required=False, allow_none=True) callable = fields.String(required=False, allow_none=True) source = fields.String(required=False, allow_none=True) updated_at = fields.String(required=True) file_name = fields.String(required=True)Ancestors
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
var callablevar errorvar file_namevar filepathvar optsvar sourcevar statusvar stepvar successvar tracebackvar updated_at