Skip to content

Commit

Permalink
feat(specs): add runSource endpoint (#3453)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Aug 2, 2024
1 parent 27679b7 commit b90bef2
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
29 changes: 29 additions & 0 deletions specs/ingestion/common/schemas/source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,32 @@ SourceWatchResponse:
type: string
required:
- message

RunSourcePayload:
type: object
additionalProperties: false
properties:
indexToInclude:
type: array
description: List of index names to include in reidexing/update.
items:
type: string
indexToExclude:
type: array
description: List of index names to exclude in reidexing/update.
items:
type: string
entityIDs:
type: array
items:
type: string
description: List of entityID to update.
entityType:
$ref: '#/EntityType'

EntityType:
type: string
description: Type of entity to update.
enum:
- product
- collection
39 changes: 39 additions & 0 deletions specs/ingestion/paths/sources/runSource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
post:
tags:
- sources
summary: Run all tasks linked to a source
description: Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
operationId: runSource
x-acl:
- addObject
- deleteIndex
- editSettings
parameters:
- $ref: '../../common/parameters.yml#/pathSourceID'
requestBody:
description: ''
content:
application/json:
schema:
$ref: '../../common/schemas/source.yml#/RunSourcePayload'
responses:
'200':
description: OK
content:
application/json:
schema:
title: runSourceResponse
type: object
properties:
taskWithRunID:
type: object
description: Map of taskID sent for reindex with the corresponding runID.
additionalProperties:
type: string
createdAt:
$ref: '../../common/schemas/common.yml#/createdAt'
required:
- taskWithRunID
- createdAt
'400':
$ref: '../../../common/responses/BadRequest.yml'
2 changes: 2 additions & 0 deletions specs/ingestion/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ paths:
$ref: 'paths/sources/validateID.yml'
/1/sources/{sourceID}/discover:
$ref: 'paths/sources/discover.yml'
/1/sources/{sourceID}/run:
$ref: 'paths/sources/runSource.yml'

# tasks API.
/1/tasks:
Expand Down
33 changes: 33 additions & 0 deletions tests/CTS/requests/ingestion/runSource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[
{
"parameters": {
"sourceID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
"runSourcePayload": {
"indexToInclude": [
"products_us",
"products eu"
],
"entityIDs": [
"1234",
"5678"
],
"entityType": "product"
}
},
"request": {
"path": "/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/run",
"method": "POST",
"body": {
"indexToInclude": [
"products_us",
"products eu"
],
"entityIDs": [
"1234",
"5678"
],
"entityType": "product"
}
}
}
]

0 comments on commit b90bef2

Please sign in to comment.