Skip to content

Commit a7ebbbc

Browse files
committed
Fix compatibility issue with fastapi >= 0.112.3
If fastapi is installed we path the method used to build the field definition from model to ensure that the registry is initialized. From version 0.112.3 the patched method 'create_response_field' has been renamed 'create_model_field'. This change ensure that this new method is also patched fixes #20
1 parent 74e5cf7 commit a7ebbbc

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

news/20.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes compatibility issue with fastapi version >= 0.112.3

src/extendable_pydantic/_patch.py

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ def _create_response_field_wrapper(wrapped, instance, args, kwargs):
6666
_resolve_model_fields_annotation([field])
6767
return field
6868

69+
# fastapi < 0.112.3
6970
wrapt.wrap_function_wrapper(
7071
utils, "create_response_field", _create_response_field_wrapper
7172
)
73+
74+
# fastapi >= 0.112.3
75+
wrapt.wrap_function_wrapper(
76+
utils, "create_model_field", _create_response_field_wrapper
77+
)

0 commit comments

Comments
 (0)