-
Notifications
You must be signed in to change notification settings - Fork 233
fix: skip doc attributes in __annotations__ but not in __fields__ #1777
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
Conversation
Signed-off-by: Joan Fontanals Martinez <[email protected]>
e813ede
to
eea8c76
Compare
Thanks for doing this! |
@@ -51,6 +51,8 @@ class MyDoc(BaseDoc): | |||
""" | |||
fields: Dict[str, Any] = {} | |||
for field_name, field in model.__annotations__.items(): | |||
if field_name not in model.__fields__: | |||
continue | |||
field_info = model.__fields__[field_name].field_info |
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.
FWIW: It might be a good idea to use something like pydash.get
here in case traversal breaks at a different location.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1777 +/- ##
==========================================
+ Coverage 84.99% 85.01% +0.01%
==========================================
Files 134 134
Lines 8845 8847 +2
==========================================
+ Hits 7518 7521 +3
+ Misses 1327 1326 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Actually, @NarekA it would be nice if you could open this PR on your own so that we can properly credit the actual contributor. I just did not want to annoy you with it, but since you have already seen this and you are now aware of this need, it may be good to have this. Could you open such a PR? |
Opening a new PR now |
Here: #1779 |
📝 Docs are deployed on https://ft-fix-skip-annotations-not-in-field--jina-docs.netlify.app 🎉 |
Porting fix jina-ai/serve#6035 to docarray