Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional interface to AvroModel #747

Open
hhoeflin opened this issue Sep 15, 2024 · 1 comment
Open

Functional interface to AvroModel #747

hhoeflin opened this issue Sep 15, 2024 · 1 comment

Comments

@hhoeflin
Copy link

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

@marcosschroh
Copy link
Owner

Hi @hhoeflin

It makes sense. I have to fix other things first before working on this. If you have any draft send it and we can take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants