Skip to content

Commit c91ca54

Browse files
Fluf22shortcuts
andauthored
feat(specs): add validate endpoint (#3087)
Co-authored-by: shortcuts <vannicattec@gmail.com>
1 parent d55eee1 commit c91ca54

File tree

6 files changed

+137
-0
lines changed

6 files changed

+137
-0
lines changed

specs/ingestion/common/schemas/source.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,25 @@ sourceShopifyBase:
524524
- shopURL
525525
x-discriminator-fields:
526526
- shopURL
527+
528+
SourceValidateResponse:
529+
type: object
530+
additionalProperties: false
531+
properties:
532+
runID:
533+
$ref: './common.yml#/runID'
534+
data:
535+
type: array
536+
description: depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
537+
items:
538+
type: object
539+
events:
540+
description: in case of error, observability events will be added to the response, if any.
541+
type: array
542+
items:
543+
$ref: '../../common/schemas/event.yml#/Event'
544+
message:
545+
description: a message describing the outcome of a validate run.
546+
type: string
547+
required:
548+
- message
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
post:
2+
tags:
3+
- sources
4+
summary: Validates a source payload
5+
description: |
6+
Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
7+
operationId: validateSource
8+
x-acl:
9+
- addObject
10+
- deleteIndex
11+
- editSettings
12+
requestBody:
13+
description: ''
14+
content:
15+
application/json:
16+
schema:
17+
$ref: '../../common/schemas/source.yml#/SourceCreate'
18+
responses:
19+
'200':
20+
description: OK
21+
content:
22+
application/json:
23+
schema:
24+
$ref: '../../common/schemas/source.yml#/SourceValidateResponse'
25+
'400':
26+
$ref: '../../../common/responses/BadRequest.yml'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
post:
2+
tags:
3+
- sources
4+
summary: Validates an update of a source payload
5+
description: |
6+
Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
7+
operationId: validateSourceBeforeUpdate
8+
x-acl:
9+
- addObject
10+
- deleteIndex
11+
- editSettings
12+
parameters:
13+
- $ref: '../../common/parameters.yml#/pathSourceID'
14+
requestBody:
15+
content:
16+
application/json:
17+
schema:
18+
$ref: '../../common/schemas/source.yml#/SourceUpdate'
19+
required: true
20+
responses:
21+
'200':
22+
description: OK
23+
content:
24+
application/json:
25+
schema:
26+
$ref: '../../common/schemas/source.yml#/SourceValidateResponse'
27+
'400':
28+
$ref: '../../../common/responses/BadRequest.yml'

specs/ingestion/spec.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,14 @@ paths:
122122
# sources API.
123123
/1/sources:
124124
$ref: 'paths/sources/sources.yml'
125+
/1/sources/validate:
126+
$ref: 'paths/sources/validate.yml'
125127
/1/sources/search:
126128
$ref: 'paths/sources/searchSources.yml'
127129
/1/sources/{sourceID}:
128130
$ref: 'paths/sources/sourceID.yml'
131+
/1/sources/{sourceID}/validate:
132+
$ref: 'paths/sources/validateID.yml'
129133
/1/sources/{sourceID}/discover:
130134
$ref: 'paths/sources/discover.yml'
131135

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[
2+
{
3+
"testName": "validateSource",
4+
"parameters": {
5+
"type": "commercetools",
6+
"name": "sourceName",
7+
"input": {
8+
"storeKeys": [
9+
"myStore"
10+
],
11+
"locales": [
12+
"de"
13+
],
14+
"url": "http://commercetools.com",
15+
"projectKey": "keyID"
16+
},
17+
"authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
18+
},
19+
"request": {
20+
"path": "/1/sources/validate",
21+
"method": "POST",
22+
"body": {
23+
"type": "commercetools",
24+
"name": "sourceName",
25+
"input": {
26+
"storeKeys": [
27+
"myStore"
28+
],
29+
"locales": [
30+
"de"
31+
],
32+
"url": "http://commercetools.com",
33+
"projectKey": "keyID"
34+
},
35+
"authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
36+
}
37+
}
38+
}
39+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"testName": "validateSourceBeforeUpdate",
4+
"parameters": {
5+
"sourceID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
6+
"sourceUpdate": {
7+
"name": "newName"
8+
}
9+
},
10+
"request": {
11+
"path": "/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate",
12+
"method": "POST",
13+
"body": {
14+
"name": "newName"
15+
}
16+
}
17+
}
18+
]

0 commit comments

Comments
 (0)