Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #341 from basiqio/DX-567-validating-webhooks-with-…
Browse files Browse the repository at this point in the history
…redocly-cli-and-git-hub-actions

DX-567 Addition of Linter on Webhooks with Redocly CLI
  • Loading branch information
basiq-brad authored Feb 1, 2024
2 parents 5c86b2a + a88fd95 commit 6f7562d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 61 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ jobs:

- name: Lint Identity
run: npx @redocly/cli lint identity.yml

- name: Lint Webhooks
run: npx @redocly/cli lint webhooks.yml

- name: Send custom JSON data to Slack workflow
if: failure() # This step will run only if the previous step fails
Expand Down
112 changes: 51 additions & 61 deletions webhooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ info:
description: Webhooks
version: "2.4.1"
title: Webhooks
termsOfService: 'https://docs.basiq.io/en/collections/440849-privacy-terms-and-common-questions'
license:
name: Commercial
url: https://basiq.io
servers:
- description: Basiq Webhooks
url: 'https://au-api.basiq.io/'
url: https://au-api.basiq.io
tags:
- name: Webhooks
description: BASIQ Webhooks
description: Basiq Webhooks
paths:
'/notifications/webhooks':
/notifications/webhooks:
post:
tags:
- Webhooks
Expand All @@ -36,8 +40,8 @@ paths:
status: active
secret: rfiuheo43934
subscribedEvents:
- payrequest.successful
- user.created
- payrequest.successful
- user.created
links:
self: 'https://au-api.basiq.io/notifications/webhooks/3fa85f64-5717-4562-b3fc-2c963f66afa6'
'400':
Expand Down Expand Up @@ -176,7 +180,7 @@ paths:
size: 1
count: 1
data:
- id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
name: 'My General Webhook'
description: 'Webhook that catches all my events'
url: https://piper.com/basiq-messages/
Expand All @@ -188,7 +192,6 @@ paths:
self: 'https://au-api.basiq.io/notifications/webhooks/3fa85f64-5717-4562-b3fc-2c963f66afa6'
links:
self: 'https://au-api.basiq.io/notifications/webhooks'
next:
'401':
description: 'Unauthorized'
content:
Expand Down Expand Up @@ -255,7 +258,7 @@ paths:
code: 'service-unavailable'
title: 'Service Unavailable'
detail: 'Service Unavailable. Try again later.'
'/notifications/webhooks/{webhookId}':
/notifications/webhooks/{webhookId}:
post:
tags:
- Webhooks
Expand All @@ -280,7 +283,7 @@ paths:
examples:
Success:
value:
type: 'webhook'
type: Webhook
id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
name: 'My General Webhook'
description: 'Webhook that catches all my events'
Expand Down Expand Up @@ -681,7 +684,7 @@ paths:
code: 'service-unavailable'
title: 'Service Unavailable'
detail: 'Service Unavailable. Try again later.'
'/notifications/webhooks/{webhookId}/messages':
/notifications/webhooks/{webhookId}/messages:
get:
tags:
- Webhooks
Expand Down Expand Up @@ -742,15 +745,11 @@ paths:
links:
event: https://au-api.basiq.io/events/44a85f64-5717-4562-b3fc-2c963f66af44
eventEntity: https://au-api.basiq.io/users/12a85f64-5717-4562-b3fc-2c963f66af12
# attempts:
# - timestamp: '2019-08-24T14:15:22Z'
# status: 'Success'
links:
self: https://au-api.basiq.io/notifications/webhooks/3fa85f64-5717-4562-b3fc-2c963f66afa6/messages/11a85f64-5717-4562-b3fc-2c963f66af11
webhook: https://au-api.basiq.io/notifications/webhooks/3fa85f64-5717-4562-b3fc-2c963f66afa6
links:
self: https://au-api.basiq.io/notifications/webhooks/3fa85f64-5717-4562-b3fc-2c963f66afa6/messages/
next:
'400':
description: 'Bad Request'
content:
Expand Down Expand Up @@ -851,7 +850,7 @@ paths:
code: 'service-unavailable'
title: 'Service Unavailable'
detail: 'Service Unavailable. Try again later.'
'/notifications/webhooks/{webhookId}/messages/{messageId}':
/notifications/webhooks/{webhookId}/messages/{messageId}:
get:
tags:
- Webhooks
Expand Down Expand Up @@ -1004,7 +1003,7 @@ paths:
code: 'service-unavailable'
title: 'Service Unavailable'
detail: 'Service Unavailable. Try again later.'
'/notifications/messages/test':
/notifications/messages/test:
post:
tags:
- Webhooks
Expand Down Expand Up @@ -1150,42 +1149,6 @@ components:
parameter:
type: string
description: String indicating which URI query parameter caused the error.
EventTypes:
properties:
type:
type: string
count:
type: integer
size:
type: integer
data:
type: array
description: one or more events that the webhook would send messages for.
allOf:
- $ref: '#/components/schemas/EventType'
links:
type: object
properties:
self:
type: string
next:
type: string
EventType:
type: object
properties:
id:
type: string
description: Identifer of the event type
example: user.created
description:
type: string
description: a brief description of the event type
example: when a user is created
links:
type: object
properties:
self:
type: string
Webhooks:
properties:
type:
Expand Down Expand Up @@ -1215,6 +1178,9 @@ components:
type: string
format: uuid
description: unique identifer in the form of uuid for the webhook.
type:
type: string
example: Webhook
name:
type: string
description: name to describe the webhook.
Expand All @@ -1234,10 +1200,8 @@ components:
type: string
description: secret for signing the messages.
subscribedEvents:
type: object
type: array
description: one or more events that the webhook would send messages for.
required:
- subscribedEvents
properties:
subscribedEvents:
type: array
Expand All @@ -1250,6 +1214,8 @@ components:
properties:
self:
type: string
next:
type: string
Messages:
properties:
type:
Expand All @@ -1259,8 +1225,9 @@ components:
size:
type: integer
data:
allOf:
- $ref: '#/components/schemas/Message'
type: array
items:
$ref: '#/components/schemas/Message'
links:
type: object
properties:
Expand All @@ -1285,13 +1252,39 @@ components:
type: string
eventId:
type: string
payload:
type: object
properties:
eventTypeId:
type: string
eventId:
type: string
links:
type: object
properties:
self:
type: string
eventEntity:
type: string
event:
type: string
webhook:
type: string
next:
type: string
attempts:
type: array
links:
type: object
properties:
self:
type: string
event:
type: string
webhook:
type: string
next:
type: string
requestBodies:
Webhook:
content:
Expand All @@ -1300,7 +1293,6 @@ components:
type: object
required:
- url
- subscribedEvents
properties:
name:
type: string
Expand All @@ -1325,15 +1317,13 @@ components:
- payrequest.successful
- user.created
description: Webhook request object.
required: true
TestMessage:
content:
application/json:
schema:
type: object
required:
- eventTypeId
- subscribedEvents
properties:
eventTypeId:
type: string
Expand Down Expand Up @@ -1361,4 +1351,4 @@ x-readme:
- node
- ruby
- javascript
- python
- python

0 comments on commit 6f7562d

Please sign in to comment.