-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Regression: deep avro models no longer converted to dict #324
Comments
Hi @joaoe Thansk for reporting this issue. I will fix it asap. Regarding unpacking enums I think it is not a good idea as I would like to have the same default behavior as pydantic |
@marcosschroh Hi.
I tried the fix I suggested above in my local setup because it was still in schema_generator with AvroModel in scope and it worked for my project where I had lists of objects. But then I did a reduced testcase and I did not think of puting ModelA() inside nested lists. |
Describe the bug
Bug introduced here
9d10708
Deeply nested Avro Models no longer recursively convert to PODs when calling
AvroModel.asdict()
To Reproduce
This shall pass.
asdict()
call fails to traverse to nested models, but at least unpacks the enum at the top level.dict()
call works from before and follows nested models, but it fails to convert the enum already before this regression was introduced.asdict()
internally calleddict()+AvroModel.standardize_custom_type()
which both converted nested objects and unpacked enums. I need that for my project :) thanks!Expected behavior
Here
dataclasses-avroschema/dataclasses_avroschema/schema_generator.py
Line 162 in 5e26fb3
That function misses a check for
PS: could perhaps
dict()
unpack enums as well, please ? But as far as I see, that call is 100% in pydantic, so either you'd need to wrap it or find a solution inside pydantic. Seeuse_enum_values
in https://docs.pydantic.dev/latest/usage/model_config/The text was updated successfully, but these errors were encountered: