Skip to content

Commit

Permalink
Merge pull request #1146 from federicobond/webhook-tags
Browse files Browse the repository at this point in the history
Add tags support to OpenApiWebhook
  • Loading branch information
tfranzel authored Feb 19, 2024
2 parents 473d2d8 + 2c997a8 commit f9f0336
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drf_spectacular/plumbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,10 @@ def process_webhooks(webhooks: List[OpenApiWebhook], registry: ComponentRegistry
if summary:
operation['summary'] = summary

tags = mocked_view.schema.get_tags()
if tags:
operation['tags'] = tags

request_body = mocked_view.schema._get_request_body('response')
if request_body:
operation['requestBody'] = request_body
Expand Down
1 change: 1 addition & 0 deletions tests/test_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class EventSerializer(serializers.Serializer):
decorator=extend_schema(
summary="some summary",
description='pushes events to a webhook url as "application/x-www-form-urlencoded"',
tags=["webhooks"],
request={
'application/x-www-form-urlencoded': EventSerializer,
},
Expand Down
2 changes: 2 additions & 0 deletions tests/test_webhooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ webhooks:
post:
description: pushes events to a webhook url as "application/x-www-form-urlencoded"
summary: some summary
tags:
- webhooks
requestBody:
content:
application/x-www-form-urlencoded:
Expand Down

0 comments on commit f9f0336

Please sign in to comment.