Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
40 changes: 37 additions & 3 deletions specs/ingestion/common/schemas/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,41 @@ TaskCreateResponse:
- taskID
- createdAt

TaskUpdate:
TaskReplace:
type: object
additionalProperties: false
description: API request body for updating a task.
properties:
destinationID:
$ref: './common.yml#/destinationID'
action:
$ref: '#/ActionType'
subscriptionAction:
$ref: '#/ActionType'
cron:
$ref: '#/Cron'
enabled:
type: boolean
description: Whether the task is enabled.
failureThreshold:
$ref: '#/failureThreshold'
input:
$ref: '#/TaskInput'
cursor:
$ref: './common.yml#/cursor'
notifications:
$ref: '#/Notifications'
policies:
$ref: '#/Policies'
required:
- destinationID
- action

# TODO: rename TaskUpdate to TaskPartialUpdate next major
TaskUpdate:
type: object
additionalProperties: false
description: API request body for partially updating a task.
properties:
destinationID:
$ref: './common.yml#/destinationID'
Expand Down Expand Up @@ -215,8 +246,7 @@ TaskUpdateV1:
input:
$ref: '#/TaskInput'
enabled:
type: boolean
description: Whether the task is enabled.
$ref: '#/Enabled'
failureThreshold:
$ref: '#/failureThreshold'

Expand Down Expand Up @@ -309,6 +339,10 @@ Cron:
description: Cron expression for the task's schedule.
example: '* * 1 * *'

Enabled:
type: boolean
description: Whether the task is enabled.

ScheduleTriggerType:
type: string
description: Task runs on a schedule.
Expand Down
29 changes: 27 additions & 2 deletions specs/ingestion/paths/tasks/v2/taskID.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,36 @@ get:
'400':
$ref: '../../../../common/responses/BadRequest.yml'

put:
tags:
- tasks
summary: Fully updates a task
description: Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
operationId: replaceTask
parameters:
- $ref: '../../../common/parameters.yml#/pathTaskID'
requestBody:
content:
application/json:
schema:
$ref: '../../../common/schemas/task.yml#/TaskReplace'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../../../common/schemas/task.yml#/TaskUpdateResponse'
'400':
$ref: '../../../../common/responses/BadRequest.yml'

# TODO: rename taskUpdate to taskPartialUpdate next major
patch:
tags:
- tasks
summary: Update a task
description: Updates a task by its ID.
summary: Partially updates a task
description: Partially updates a task by its ID.
operationId: updateTask
parameters:
- $ref: '../../../common/parameters.yml#/pathTaskID'
Expand Down
12 changes: 6 additions & 6 deletions tests/CTS/requests/ingestion/createTask.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"testName": "task without cron",
"parameters": {
"sourceID": "search",
"destinationID": "destinationName",
"destinationID": "destinationID",
"action": "replace"
},
"request": {
"path": "/2/tasks",
"method": "POST",
"body": {
"sourceID": "search",
"destinationID": "destinationName",
"destinationID": "destinationID",
"action": "replace"
}
}
Expand All @@ -20,7 +20,7 @@
"testName": "task with cron",
"parameters": {
"sourceID": "search",
"destinationID": "destinationName",
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"notifications": {
Expand All @@ -37,7 +37,7 @@
"method": "POST",
"body": {
"sourceID": "search",
"destinationID": "destinationName",
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"notifications": {
Expand All @@ -55,7 +55,7 @@
"testName": "task shopify",
"parameters": {
"sourceID": "search",
"destinationID": "destinationName",
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"input": {
Expand All @@ -72,7 +72,7 @@
"method": "POST",
"body": {
"sourceID": "search",
"destinationID": "destinationName",
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"input": {
Expand Down
92 changes: 92 additions & 0 deletions tests/CTS/requests/ingestion/replaceTask.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[
{
"testName": "fully replace task without cron",
"parameters": {
"taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"taskReplace": {
"destinationID": "destinationID",
"action": "replace"
}
},
"request": {
"path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"method": "PUT",
"body": {
"destinationID": "destinationID",
"action": "replace"
}
}
},
{
"testName": "fully replace task with cron",
"parameters": {
"taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"taskReplace": {
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"notifications": {
"email": {
"enabled": true
}
},
"policies": {
"criticalThreshold": 8
}
}
},
"request": {
"path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"method": "PUT",
"body": {
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"notifications": {
"email": {
"enabled": true
}
},
"policies": {
"criticalThreshold": 8
}
}
}
},
{
"testName": "fully replace task shopify",
"parameters": {
"taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"taskReplace": {
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"input": {
"streams": [
{
"name": "foo",
"syncMode": "incremental"
}
]
}
}
},
"request": {
"path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"method": "PUT",
"body": {
"destinationID": "destinationID",
"cron": "* * * * *",
"action": "replace",
"input": {
"streams": [
{
"name": "foo",
"syncMode": "incremental"
}
]
}
}
}
}
]
28 changes: 14 additions & 14 deletions tests/output/javascript/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,12 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:22.16.5":
version: 22.16.5
resolution: "@types/node@npm:22.16.5"
"@types/node@npm:22.18.0":
version: 22.18.0
resolution: "@types/node@npm:22.18.0"
dependencies:
undici-types: "npm:~6.21.0"
checksum: 10/ba45b5c9113cbc5edb12960fcfe7e80db2c998af5c1931264240695b27d756570d92462150b95781bd67a03aa82111cc970ab0f4504eb99213edff8bf425354e
checksum: 10/c4e4cdac52aae71e120fb4a02a08f774366e8bd6654de9376fb1113fb66cfa2706176b72f188069cdecdb40e5cdde2befa031dc720a0cc0b1e349af9e38492ad
languageName: node
linkType: hard

Expand Down Expand Up @@ -1022,9 +1022,9 @@ __metadata:
"@algolia/client-composition": "link:../../../clients/algoliasearch-client-javascript/packages/client-composition"
"@algolia/composition": "link:../../../clients/algoliasearch-client-javascript/packages/composition"
"@algolia/requester-testing": "link:../../../clients/algoliasearch-client-javascript/packages/requester-testing"
"@types/node": "npm:22.16.5"
"@types/node": "npm:22.18.0"
algoliasearch: "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch"
typescript: "npm:5.8.3"
typescript: "npm:5.9.2"
vitest: "npm:3.2.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -1621,23 +1621,23 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:5.8.3":
version: 5.8.3
resolution: "typescript@npm:5.8.3"
"typescript@npm:5.9.2":
version: 5.9.2
resolution: "typescript@npm:5.9.2"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/65c40944c51b513b0172c6710ee62e951b70af6f75d5a5da745cb7fab132c09ae27ffdf7838996e3ed603bb015dadd099006658046941bd0ba30340cc563ae92
checksum: 10/cc2fe6c822819de5d453fa25aa9f32096bf70dde215d481faa1ad84a283dfb264e33988ed8f6d36bc803dd0b16dbe943efa311a798ef76d5b3892a05dfbfd628
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A5.8.3#optional!builtin<compat/typescript>":
version: 5.8.3
resolution: "typescript@patch:typescript@npm%3A5.8.3#optional!builtin<compat/typescript>::version=5.8.3&hash=5786d5"
"typescript@patch:typescript@npm%3A5.9.2#optional!builtin<compat/typescript>":
version: 5.9.2
resolution: "typescript@patch:typescript@npm%3A5.9.2#optional!builtin<compat/typescript>::version=5.9.2&hash=5786d5"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10/b9b1e73dabac5dc730c041325dbd9c99467c1b0d239f1b74ec3b90d831384af3e2ba973946232df670519147eb51a2c20f6f96163cea2b359f03de1e2091cc4f
checksum: 10/bd810ab13e8e557225a8b5122370385440b933e4e077d5c7641a8afd207fdc8be9c346e3c678adba934b64e0e70b0acf5eef9493ea05170a48ce22bef845fdc7
languageName: node
linkType: hard

Expand Down