-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: Possibility for original schema string in objects Meta class. #545
feat: Possibility for original schema string in objects Meta class. #545
Conversation
…e and "original_schema" key check in metadata_field_templates to allow adding of original schema string in class meta class field "original_schema" We noticed it's possible for the generated avro schema, from the generated models, to deviate from the original schema. In order to guarantee exact matching, the original schema can be included in the models themselves.
Thanks for the PR. Ideally, the generated model must match perfectly the original schema, unfortunately is not the case for We can use your solution until we implement a new fix. Regarding the PR I have suggestions:
model_generator = ModelGenerator(include_original_schema=True)
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #545 +/- ##
==========================================
+ Coverage 99.18% 99.65% +0.46%
==========================================
Files 30 30
Lines 1712 1721 +9
Branches 307 0 -307
==========================================
+ Hits 1698 1715 +17
Misses 6 6
+ Partials 8 0 -8 ☔ View full report in Codecov by Sentry. |
Thanks for the feedback. I have implemented your feedback and included the new feature in the docs of model_generator. |
(ModelGenerator-in-generator.py,-templates.py)
Added new template and "original_schema" key check in metadata_field_templates to allow adding of original schema string in class meta class field "original_schema"
We noticed it's possible for the generated avro schema, from the generated models, to deviate from the original schema. In order to guarantee exact matching, the original schema can be included in the models themselves.
Original issue: #544
Curious to hear your thoughts on this. It's a nice workaround for our issue without breaking anything of the original functionality. I've tried to leverage the existing code base. But as you'll find, the possibility of including the original schema string is not obvious from the current code as is.
P.S: Also went ahead to fix, what seemed to be a typo, matadata_field_templates -> metadata_field_templates