andreahlert commented on code in PR #668:
URL: https://github.com/apache/burr/pull/668#discussion_r2955143921
##########
burr/integrations/pydantic.py:
##########
@@ -76,7 +77,8 @@ def subset_model(
"""
new_fields = {}
- for name, field_info in model.model_fields.items():
+ model_cls = model if isinstance(model, type) else type(model) # Handles
the possibility that sometimes model is a class not instance
+ for name, field_info in model_cls.model_fields.items():
if name in fields:
# copy directly
Review Comment:
Same pattern again. `_validate_keys` takes `model: Type[pydantic.BaseModel]`
- always a class. No fix needed.
Out of the 4 functions changed in this PR, only `model_to_dict` actually
needed the fix. The other 3 already accessed `model_fields` on the class and
never triggered the deprecation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]