-
Notifications
You must be signed in to change notification settings - Fork 187
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
fix: docs Autodetect for schemas #563
fix: docs Autodetect for schemas #563
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching this! I'm surprised such an error has gone unnoticed for so long.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #563 +/- ##
=======================================
Coverage 93.71% 93.71%
=======================================
Files 102 102
Lines 11156 11156
Branches 1534 1534
=======================================
Hits 10455 10455
Misses 613 613
Partials 88 88 ☔ View full report in Codecov by Sentry. |
It seems the Lines 166 to 203 in 3fb3180
Looking at both of these, it was not immediately apparent to me as to which implementation Ask Solem intended to use in the example above, since there's no To be honest I should be testing this myself to make sure it works. I've never used autodetection before because I've always believed that it to be in best practice to use one schema per Kafka topic, because non-Faust applications may also need to consume from a particular topic and my experiences with https://marcosschroh.github.io/dataclasses-avroschema/faust_records/ show me that, despite how powerful these Records are, they can also make your life quite difficult. I'm still approving it because the implementation in the documentation is not properly documented anyway and the changes here make it more clear. |
(Fixes #560)
Description
I noticed a discrepancy in the documentation, specifically in the example for the Autodetect class. Here are the details of the issue I fixed:
In the documentation example, the variable value_type was not defined before being referenced in the following lines of code:
It appears that there might have been a typo or misunderstanding, and it should have been
value_type_name
instead ofvalue_type
.Additionally, I noticed a comment in the code that seemed to be a victim of a copy-paste error. It read:
try to get key_type and serializer from Kafka headers,
which I believe should have been:try to get value_type and serializer from Kafka headers.
I fixed the issue by making the necessary changes, and I also raised questions about whether it is intended to pass
message.key
in the last line, and ifmessage.value
should be considered instead.