Check if any param of param_type is presented as default or Annotated
within the call signature.
Source code in faststream/broker/fastapi/get_dependant.py
| def has_signature_param(orig_call: Callable[..., Any], param_type: type) -> bool:
"""Check if any param of param_type is presented as default or `Annotated` within the call signature."""
endpoint_signature = get_typed_signature(orig_call)
signature_params = endpoint_signature.parameters
for param in signature_params.values():
ann = param.annotation
if ann is not inspect.Signature.empty and get_origin(ann) is Annotated:
annotated_args = get_args(ann)
for arg in annotated_args:
if isinstance(arg, param_type):
return True
if isinstance(param.default, param_type):
return True
return False
|