minos.common.model.serializers.abc

Classes

DataDecoder

Data Decoder base class.

DataEncoder

Data Encoder base class.

SchemaDecoder

Schema Decoder base class.

SchemaEncoder

Schema Encoder base class.

class SchemaEncoder[source]

Bases: 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.

  • type_ (Union[type, Model, Field]) –

Returns

A dictionary object.

Return type

Any

class SchemaDecoder[source]

Bases: ABC

Schema Decoder base class.

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

Build type from given avro schema item.

Parameters

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

Returns

A type object.

Return type

type

class DataEncoder[source]

Bases: 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 (Any) – The value to be encoded.

Returns

A avro-compatible data.

Return type

Any

class DataDecoder[source]

Bases: ABC

Data Decoder base class.

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

Cast data type according to the field definition.

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

  • type – The type of the decoded data.

  • type_ (Any) –

Returns

The casted object.

Return type

Any