Skip to content

Commit 7d2ab99

Browse files
authored
feat(specs): add authentications to ingestion transformations (#3494)
1 parent 078868b commit 7d2ab99

File tree

6 files changed

+152
-1
lines changed

6 files changed

+152
-1
lines changed

specs/ingestion/common/schemas/transformation.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Transformation:
44
properties:
55
transformationID:
66
$ref: './common.yml#/transformationID'
7+
authenticationIDs:
8+
$ref: '#/AuthenticationIDs'
79
code:
810
$ref: '#/Code'
911
name:
@@ -32,6 +34,12 @@ Description:
3234
type: string
3335
description: A descriptive name for your transformation of what it does.
3436

37+
AuthenticationIDs:
38+
description: The authentications associated for the current transformation.
39+
type: array
40+
items:
41+
$ref: './common.yml#/authenticationID'
42+
3543
TransformationCreate:
3644
type: object
3745
additionalProperties: false
@@ -43,6 +51,8 @@ TransformationCreate:
4351
$ref: '#/Name'
4452
description:
4553
$ref: '#/Description'
54+
authenticationIDs:
55+
$ref: '#/AuthenticationIDs'
4656
required:
4757
- code
4858
- name
@@ -93,6 +103,10 @@ TransformationTry:
93103
sampleRecord:
94104
description: The record to apply the given code to.
95105
type: object
106+
authentications:
107+
type: array
108+
items:
109+
$ref: './authentication.yml#/AuthenticationCreate'
96110
required:
97111
- code
98112
- sampleRecord
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
post:
2+
tags:
3+
- transformations
4+
summary: Try a transformation
5+
description: Try a transformation before updating it.
6+
operationId: tryTransformationBeforeUpdate
7+
x-acl:
8+
- addObject
9+
- deleteIndex
10+
- editSettings
11+
parameters:
12+
- $ref: '../../common/parameters.yml#/pathTransformationID'
13+
requestBody:
14+
content:
15+
application/json:
16+
schema:
17+
$ref: '../../common/schemas/transformation.yml#/TransformationTry'
18+
required: true
19+
responses:
20+
'200':
21+
description: OK
22+
content:
23+
application/json:
24+
schema:
25+
$ref: '../../common/schemas/transformation.yml#/TransformationTryResponse'
26+
'400':
27+
$ref: '../../../common/responses/BadRequest.yml'

specs/ingestion/paths/transformations/transformationsTry.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ post:
22
tags:
33
- transformations
44
summary: Try a transformation
5-
description: Try a transformation.
5+
description: Try a transformation before creating it.
66
operationId: tryTransformation
77
x-acl:
88
- addObject

specs/ingestion/spec.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ paths:
179179
$ref: 'paths/transformations/transformationsModels.yml'
180180
/1/transformations/{transformationID}:
181181
$ref: 'paths/transformations/transformationID.yml'
182+
/1/transformations/{transformationID}/try:
183+
$ref: 'paths/transformations/transformationTryID.yml'
182184

183185
# observability API.
184186
/1/runs:

tests/CTS/requests/ingestion/tryTransformation.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,46 @@
1616
}
1717
}
1818
}
19+
},
20+
{
21+
"testName": "with authentications",
22+
"parameters": {
23+
"code": "foo",
24+
"sampleRecord": {
25+
"bar": "baz"
26+
},
27+
"authentications": [
28+
{
29+
"type": "oauth",
30+
"name": "authName",
31+
"input": {
32+
"url": "http://test.oauth",
33+
"client_id": "myID",
34+
"client_secret": "mySecret"
35+
}
36+
}
37+
]
38+
},
39+
"request": {
40+
"path": "/1/transformations/try",
41+
"method": "POST",
42+
"body": {
43+
"code": "foo",
44+
"sampleRecord": {
45+
"bar": "baz"
46+
},
47+
"authentications": [
48+
{
49+
"type": "oauth",
50+
"name": "authName",
51+
"input": {
52+
"url": "http://test.oauth",
53+
"client_id": "myID",
54+
"client_secret": "mySecret"
55+
}
56+
}
57+
]
58+
}
59+
}
1960
}
2061
]
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[
2+
{
3+
"parameters": {
4+
"transformationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
5+
"transformationTry": {
6+
"code": "foo",
7+
"sampleRecord": {
8+
"bar": "baz"
9+
}
10+
}
11+
},
12+
"request": {
13+
"path": "/1/transformations/6c02aeb1-775e-418e-870b-1faccd4b2c0f/try",
14+
"method": "POST",
15+
"body": {
16+
"code": "foo",
17+
"sampleRecord": {
18+
"bar": "baz"
19+
}
20+
}
21+
}
22+
},
23+
{
24+
"testName": "existing with authentications",
25+
"parameters": {
26+
"transformationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
27+
"transformationTry": {
28+
"code": "foo",
29+
"sampleRecord": {
30+
"bar": "baz"
31+
},
32+
"authentications": [
33+
{
34+
"type": "oauth",
35+
"name": "authName",
36+
"input": {
37+
"url": "http://test.oauth",
38+
"client_id": "myID",
39+
"client_secret": "mySecret"
40+
}
41+
}
42+
]
43+
}
44+
},
45+
"request": {
46+
"path": "/1/transformations/6c02aeb1-775e-418e-870b-1faccd4b2c0f/try",
47+
"method": "POST",
48+
"body": {
49+
"code": "foo",
50+
"sampleRecord": {
51+
"bar": "baz"
52+
},
53+
"authentications": [
54+
{
55+
"type": "oauth",
56+
"name": "authName",
57+
"input": {
58+
"url": "http://test.oauth",
59+
"client_id": "myID",
60+
"client_secret": "mySecret"
61+
}
62+
}
63+
]
64+
}
65+
}
66+
}
67+
]

0 commit comments

Comments
 (0)