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

mypy errors on example model when upgrading to version 0.38 #281

Closed
mdipietrowf opened this issue Apr 3, 2023 · 2 comments
Closed

mypy errors on example model when upgrading to version 0.38 #281

mdipietrowf opened this issue Apr 3, 2023 · 2 comments

Comments

@mdipietrowf
Copy link

Describe the bug
When running mypy on avro models after updating to 0.38.0, the following errors are displayed:

example.py:9: error: Definition of "validate" in base class "Model" is incompatible with definition in base class "AvroModel"  [misc]

example.py:9: error: Definition of "validate" in base class "ModelT" is incompatible with definition in base class "AvroModel"  [misc]

example.py:15: error: Incompatible types in assignment (expression has type "Tuple[str, str, str]", variable has type "Tuple[str]")  [assignment]

example.py:17: error: Incompatible types in assignment (expression has type "None", variable has type "str")  [assignment]

To Reproduce
Run mypy v1.1.1 on a file containing the UserAdvance class as in the example
https://marcosschroh.github.io/dataclasses-avroschema/faust_records/

using faust-streaming 0.10.8

Expected behavior
No mypy errors from creating example model.

@marcosschroh
Copy link
Owner

Hi @mdipietrowf

Thanks for noticing this issue. I think we should create a new class that inherits from record.Model, AvroModel and redefine the validate that will use the super().validate() in order to solve the problem and the end users will need to only inherits from one class (similar to what we do with BaseModel AvroModel = AvroBaseModel for pydantic integration.

@marcosschroh
Copy link
Owner

The faust integration has been updated so now you should not have any mypy errors

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