minos.common.model.serializers.abc module

class minos.common.model.serializers.abc.DataDecoder[source]

Bases: abc.ABC

Data Decoder base class.

abstract build(data, type_, **kwargs)[source]

Cast data type according to the field definition.

Parameters
  • data (typing.Any) – Data to be casted.

  • type – The type of the decoded data.

Return type

typing.Any

Returns

The casted object.

class minos.common.model.serializers.abc.DataEncoder[source]

Bases: abc.ABC

Data Encoder base class.

abstract build(value, **kwargs)[source]

Build an avro data representation based on the content of the given field.

Parameters

value (typing.Any) – The value to be encoded.

Return type

typing.Any

Returns

A avro-compatible data.

class minos.common.model.serializers.abc.SchemaDecoder[source]

Bases: abc.ABC

Schema Decoder base class.

abstract build(schema, **kwargs)[source]

Build type from given avro schema item.

Parameters

schema (typing.Any) – The schema to be decoded as a type.

Return type

type

Returns

A type object.

class minos.common.model.serializers.abc.SchemaEncoder[source]

Bases: abc.ABC

Schema Encoder base class.

abstract build(type_, **kwargs)[source]

Build the avro schema for the given field.

Parameters

type – The type to be encoded as a schema.

Return type

Any

Returns

A dictionary object.