-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
TypeError when parsing non-nested logicalType #726
Comments
If we all agree on the example schema being a valid AVRO schema, I don't mind resolving the bug. field = field if field_name is None or ~isinstance(field["type"], dict) else field["type"] instead of the current condition: field = field if field_name is None else field["type"] |
Hi @bengels97 Thanks for reporting the issue. In the past the avro spec defined that Because the I think we should support this use case, so go forward with your |
For our own purposes we wouldn't necessarily need to be able to generate the same schema from the model. So personally I'm fine with generating the If compatibility is broken for anyone, they could always generate the schema with |
Created a PR to meet the expected behaviour. Please take a look and let me know if you have any feedback. Have not included the generation of |
Probably this issue is related to #727 as well |
Closed by #734 |
Describe the bug
A clear and concise description of what the bug is.
Given the above example. When parsing the logical type in
BaseGenerator.parse_logical_type
a TypeError is raised due to a parsing issue when trying to accessfield["logicalType"]
.To Reproduce
Steps to reproduce the behavior
The issue can be reproduced by trying to generate a model using the above schema:
It is resolved by specifying the
type
andlogicalType
fields under atype
key. like so:Expected behavior
A clear and concise description of what you expected to happen.
I was not able to find whether the above schema is valid AVRO or not (ChatGPT told me it is, but I don't see that as a reliable source). Reformatting seems like a simple solution. But if the above AVRO is valid, then parse_logical_type should be able to parse it.
Ideally the above schema should return the below
rendered_class
, the same way that the nested type field does.The text was updated successfully, but these errors were encountered: