Skip to content

Functional interface to AvroModel #747

@hhoeflin

Description

@hhoeflin

Is your feature request related to a problem? Please describe.
Currently using AvroModel requires inheriting from it. Providing a fully functional interface would allow to use the functionality for all dataclasses. Also, this way certain rather generic method-names (like validate) that could clash with other names, would not be on every instance.

Example of this design philosophy is "attrs" the project from which dataclasses were originally derived.

Describe the solution you'd like
Looking through AvroModel, most methods seems to be classmethods - these could be extracted functionally and applied to the class passed as an argument. The instance-methods on AvroModel could be provided as functions applied to instances. The original AvroModel can get the same separately defined methods

Describe alternatives you've considered
Not sure what alternative to use. Enforcing use of AvroModel in an inheritance -schema if I dont control all classes myself seems difficult.

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions