Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(specs): add notification settings to tasks [skip-bc] #4297

Merged
merged 9 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion specs/ingestion/common/schemas/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Task:
$ref: '#/ActionType'
cursor:
$ref: './common.yml#/cursor'
notifications:
$ref: '#/Notifications'
createdAt:
$ref: './common.yml#/createdAt'
updatedAt:
Expand All @@ -41,7 +43,7 @@ TaskV1:
type: object
additionalProperties: false
deprecated: true
description: The V1 task object, please use methods and types that don't contain the V1 suffix.
description: The V1 task object, please use methods and types that doesn't contain the V1 suffix.
properties:
taskID:
$ref: './common.yml#/taskID'
Expand All @@ -63,6 +65,8 @@ TaskV1:
$ref: '#/ActionType'
cursor:
$ref: './common.yml#/cursor'
notifications:
$ref: '#/Notifications'
createdAt:
$ref: './common.yml#/createdAt'
updatedAt:
Expand Down Expand Up @@ -105,6 +109,8 @@ TaskCreate:
$ref: '#/TaskInput'
cursor:
$ref: './common.yml#/cursor'
notifications:
$ref: '#/Notifications'
required:
- sourceID
- destinationID
Expand Down Expand Up @@ -175,6 +181,8 @@ TaskUpdate:
description: Whether the task is enabled.
failureThreshold:
$ref: '#/failureThreshold'
notifications:
$ref: '#/Notifications'

TaskUpdateV1:
type: object
Expand Down Expand Up @@ -553,3 +561,24 @@ ShopifyMarket:
- countries
- currencies
- locales

Notifications:
type: object
additionalProperties: false
description: Notifications settings for a task.
properties:
email:
title: emailNotifications
type: object
additionalProperties: false
properties:
enabled:
description: Whether to send email notifications, note that this doesn't prevent the task from being blocked.
type: boolean
criticalThreshold:
description: The number of critical failures in a row before blocking the task and sending a notification.
type: integer
minimum: 1
maximum: 10
required:
- email
8 changes: 8 additions & 0 deletions specs/ingestion/common/taskParameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ triggerType:
$ref: './schemas/task.yml#/TriggerType'
example: onDemand,schedule,subscription,streaming

withNotifications:
name: withNotifications
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
withNotifications:
name: withNotifications
withEmailNotifications:
name: withEmailNotifications

better be descriptive than introduce bc when we add more notifications

in: query
description: If specified, the response only includes tasks with notifications.email.enabled set to this value.
required: false
schema:
type: boolean

sort:
name: sort
in: query
Expand Down
1 change: 1 addition & 0 deletions specs/ingestion/paths/tasks/v2/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ get:
- $ref: '../../../common/taskParameters.yml#/sourceType'
- $ref: '../../../common/taskParameters.yml#/destinationID'
- $ref: '../../../common/taskParameters.yml#/triggerType'
- $ref: '../../../common/taskParameters.yml#/withNotifications'
- $ref: '../../../common/taskParameters.yml#/sort'
- $ref: '../../../common/parameters.yml#/order'
responses:
Expand Down
16 changes: 14 additions & 2 deletions tests/CTS/requests/ingestion/createTask.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
"sourceID": "search",
"destinationID": "destinationName",
"cron": "* * * * *",
"action": "replace"
"action": "replace",
"notifications": {
"email": {
"enabled": true,
"criticalThreshold": 8
}
}
},
"request": {
"path": "/2/tasks",
Expand All @@ -31,7 +37,13 @@
"sourceID": "search",
"destinationID": "destinationName",
"cron": "* * * * *",
"action": "replace"
"action": "replace",
"notifications": {
"email": {
"enabled": true,
"criticalThreshold": 8
}
}
}
}
},
Expand Down
Loading