minos.common.model.fields

Classes

Field

Represents a model field.

ModelField

alias of Field

class Field[source]

Bases: object

Represents a model field.

__init__(name, type_, value=MissingSentinel, parser=None, validator=None)[source]
Parameters
property name: str

Name getter.

property type: type

Type getter.

property real_type: type

Real Type getter.

property parser: Optional[Callable[[Any], Any]]

Parser getter.

property validator: Optional[Callable[[Any], Any]]

Parser getter.

property value: Any

Value getter.

property avro_schema: dict[str, Any]

Compute the avro schema of the field.

Returns

A dictionary object.

property avro_data: Any

Compute the avro data of the model.

Returns

A dictionary object.

classmethod from_avro(schema, value)[source]

Build a Field instance from the avro information.

Parameters
  • schema (dict) – Field’s schema.

  • value (Any) – Field’s value.

Returns

A Field instance.

Return type

Field

ModelField

alias of Field