|
|
@ -199,20 +199,17 @@ def get_flat_params(dependant: Dependant) -> list[ModelField]: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_signature(call: Callable[..., Any]) -> inspect.Signature: |
|
|
def _get_signature(call: Callable[..., Any]) -> inspect.Signature: |
|
|
if sys.version_info >= (3, 10): |
|
|
try: |
|
|
try: |
|
|
signature = inspect.signature(call, eval_str=True) |
|
|
signature = inspect.signature(call, eval_str=True) |
|
|
except NameError: |
|
|
except NameError: |
|
|
# Handle type annotations with if TYPE_CHECKING, not used by FastAPI |
|
|
# Handle type annotations with if TYPE_CHECKING, not used by FastAPI |
|
|
# e.g. dependency return types |
|
|
# e.g. dependency return types |
|
|
if sys.version_info >= (3, 14): |
|
|
if sys.version_info >= (3, 14): |
|
|
from annotationlib import Format |
|
|
from annotationlib import Format |
|
|
|
|
|
|
|
|
signature = inspect.signature(call, annotation_format=Format.FORWARDREF) |
|
|
signature = inspect.signature(call, annotation_format=Format.FORWARDREF) |
|
|
else: |
|
|
else: |
|
|
signature = inspect.signature(call) |
|
|
signature = inspect.signature(call) |
|
|
|
|
|
else: |
|
|
|
|
|
signature = inspect.signature(call) |
|
|
|
|
|
return signature |
|
|
return signature |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|