minos.common.model.fields module

class minos.common.model.fields.Field(name, type_, value=<class 'minos.common.model.types.constants.MissingSentinel'>, parser=None, validator=None)[source]

Bases: object

Represents a model field.

__init__(name, type_, value=<class 'minos.common.model.types.constants.MissingSentinel'>, parser=None, validator=None)[source]
property avro_data: Any

Compute the avro data of the model.

Return type

typing.Any

Returns

A dictionary object.

property avro_schema: dict

Compute the avro schema of the field.

Return type

dict[str, typing.Any]

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 (typing.Any) – Field’s value.

Return type

minos.common.model.fields.Field

Returns

A Field instance.

property name: str

Name getter.

Return type

str

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

Parser getter.

Return type

typing.Optional[typing.Callable[[Any], Any]]

property real_type: type

Real Type getter.

Return type

type

property type: type

Type getter.

Return type

type

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

Parser getter.

Return type

typing.Optional[typing.Callable[[Any], Any]]

property value: Any

Value getter.

Return type

typing.Any

minos.common.model.fields.ModelField

alias of minos.common.model.fields.