Skip to content

Commit

Permalink
Default WEBHOOKS setting to an empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
federicobond committed Jan 12, 2024
1 parent 511ee20 commit 0a97683
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions drf_spectacular/plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,17 +1408,14 @@ 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
simulates a sub-schema from the opposing perspective via a virtual view definition.
"""
result = {}

if webhooks is None:
return result

for webhook in webhooks:
if isinstance(webhook.decorator, dict):
methods = webhook.decorator
Expand Down
2 changes: 1 addition & 1 deletion drf_spectacular/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {},

Expand Down

0 comments on commit 0a97683

Please sign in to comment.