Kemux stream Schema classes
Base class for Schema classes.
Schema
dataclass
Schema base Class
Provides a common interface for Schema classes to validate data and create faust.Record classes.
| Attributes: |
|
|---|
find_decorated_fields()
classmethod
Find decorated fields and compose a faust.Record subclass.
| Raises: |
|
|---|
StreamRecordT
Bases: Record
StreamRecordT Class
A type hint for custom faust.Record classes. These subclasses are created automatically by the input and output schema classes and are passed to faust.TopicT initializers as the value_type argument i.e. record models.
to_dict()
Convert the record to a dict.
| Returns: |
|
|---|
Input Schema
Input schema for Kemux.
This is the schema that is used to validate incoming messages.
InputSchema
dataclass
Bases: Schema
InputSchema Class
The schema that is used to validate incoming messages.
asdict()
classmethod
Convert the nested faust.Record subclass to a dict.
| Returns: |
|
|---|
construct_input_record_class()
classmethod
Factory used to construct the faust.Record subclass that is used to accept and validate incoming messages.
| Raises: |
|
|---|
Output Schema
Base class for output schema classes.
OutputSchema
dataclass
Bases: Schema
OutputSchema Class
The schema that is used to construct and validate outgoing messages.
construct_output_record_class()
classmethod
Factory used to construct the faust.Record subclass that is used to construct and validate outgoing messages.
transform(message)
staticmethod
Transform the message into a format that can be consumed by the output schema.
Must be implemented by user when defining a stream output messages schema. This is done instead of enforcing implementation via abstract classes, due to the fact that this class is never instantiated directly, but rather used as an interface.
| Parameters: |
|
|---|
| Raises: |
|
|---|
validate(message)
classmethod
Validate the outgoing message using schema fields defined in the OutputSchema class.
| Parameters: |
|
|---|
| Returns: |
|
|---|