Is there a way to define an authentication for webhooks in DRF Specacular
I have the following webhook definition
change_event_webhook = OpenApiWebhook(
name="AddonWebhook",
decorator=extend_schema(
summary="A Webhook event",
description="Pushes events to a notification URL. ",
tags=["webhooks"],
request={"application/json": load_schema("myschema.json")},
responses={
"2XX": OpenApiResponse("Event was received successfully"),
},
),
)
which produces the following schema
...
webhooks:
AddonWebhook:
post:
description: 'Pushes events to a notification URL. '
summary: A Webhook event for an addon
tags:
- webhooks
requestBody:
content:
application/json:
schema:
$id: https://my-schema.url/schema.json
$schema: http://json-schema.org/draft-07/schema#
title: Webhooks messaging
additionalProperties: false
definitions: {}
type: object
required:
- change_id
- action
properties:
change_id:
title: Change ID
type: integer
description: Numerical ID of change
action:
title: Change Action
type: string
description: Verbose name of the change
responses:
2XX:
content:
application/json:
schema:
type: object
additionalProperties: {}
description: Unspecified response body
description: ''
My redocly rules sets the security
as required, so when linting my schema, I get the following error "Every operation should have security defined on it or on the root level."
How can I add an authentication method (lik HMAC) to my webhook definition ? The desired result would then include something like
security:
- signatureAuth: []