diff --git a/drf_spectacular/plumbing.py b/drf_spectacular/plumbing.py index 349aae4a..e9a22ad3 100644 --- a/drf_spectacular/plumbing.py +++ b/drf_spectacular/plumbing.py @@ -1408,7 +1408,7 @@ def build_serializer_context(view) -> typing.Dict[str, Any]: return {'request': view.request} -def process_webhooks(webhooks: Union[List[OpenApiWebhook], None], registry: ComponentRegistry) -> _SchemaType: +def process_webhooks(webhooks: List[OpenApiWebhook], registry: ComponentRegistry) -> _SchemaType: """ Creates a mocked view for every webhook. The given extend_schema decorator then specifies the expectations on the receiving end of the callback. Effectively @@ -1416,9 +1416,6 @@ def process_webhooks(webhooks: Union[List[OpenApiWebhook], None], registry: Comp """ result = {} - if webhooks is None: - return result - for webhook in webhooks: if isinstance(webhook.decorator, dict): methods = webhook.decorator diff --git a/drf_spectacular/settings.py b/drf_spectacular/settings.py index 936c74dd..629b6114 100644 --- a/drf_spectacular/settings.py +++ b/drf_spectacular/settings.py @@ -201,7 +201,7 @@ 'TAGS': [], # Optional: List of OpenAPI 3.1 webhooks. Each entry should be an import path to an # OpenApiWebhook instance. - 'WEBHOOKS': None, + 'WEBHOOKS': [], # Optional: MUST contain 'url', may contain "description" 'EXTERNAL_DOCS': {},