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 /schedule endpoint #3350

Merged
merged 5 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
10 changes: 10 additions & 0 deletions specs/abtesting/common/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ abTestID:
description: Unique A/B test identifier.
example: 224

abTestScheduleID:
type: integer
description: Unique scheduled A/B test identifier.
example: 224

endAt:
type: string
description: End date and time of the A/B test, in RFC 3339 format.
Expand All @@ -33,6 +38,11 @@ updatedAt:
description: Date and time when the A/B test was last updated, in RFC 3339 format.
example: 2023-06-15T15:06:44.400601Z

scheduledAt:
type: string
description: Date and time when the A/B test is scheduled to start, in RFC 3339 format.
example: 2023-06-15T15:06:44.400601Z

name:
type: string
description: A/B test name.
Expand Down
8 changes: 8 additions & 0 deletions specs/abtesting/common/schemas/ScheduledABTestResponse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ScheduledABTestResponse:
type: object
additionalProperties: false
properties:
abTestScheduleID:
$ref: '../parameters.yml#/abTestScheduleID'
required:
- abTestScheduleID
58 changes: 58 additions & 0 deletions specs/abtesting/paths/scheduleABTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
post:
tags:
- abtest
operationId: scheduleABTest
x-acl:
- editSettings
summary: Schedule an A/B test
description: |
Schedule an A/B test to be started at a later time.
requestBody:
required: true
content:
application/json:
schema:
title: scheduleABTestsRequest
type: object
additionalProperties: false
properties:
name:
$ref: '../common/parameters.yml#/name'
variants:
type: array
description: A/B test variants.
minItems: 2
maxItems: 2
items:
$ref: '../common/schemas/AddABTestsVariant.yml#/AddABTestsVariant'
scheduledAt:
$ref: '../common/parameters.yml#/scheduledAt'
endAt:
$ref: '../common/parameters.yml#/endAt'
required:
- name
- variants
- scheduledAt
- endAt
responses:
'200':
description: OK
headers:
x-ratelimit-limit:
$ref: '../../analytics/common/parameters.yml#/x-ratelimit-limit'

Check failure on line 42 in specs/abtesting/paths/scheduleABTest.yml

View workflow job for this annotation

GitHub Actions / specs

$ref to another spec
x-ratelimit-remaining:
$ref: '../../analytics/common/parameters.yml#/x-ratelimit-remaining'

Check failure on line 44 in specs/abtesting/paths/scheduleABTest.yml

View workflow job for this annotation

GitHub Actions / specs

$ref to another spec
x-ratelimit-reset:
$ref: '../../analytics/common/parameters.yml#/x-ratelimit-reset'

Check failure on line 46 in specs/abtesting/paths/scheduleABTest.yml

View workflow job for this annotation

GitHub Actions / specs

$ref to another spec
content:
application/json:
schema:
$ref: '../common/schemas/ScheduledABTestResponse.yml#/ScheduledABTestResponse'
'400':
$ref: '../../common/responses/BadRequest.yml'
'402':
$ref: '../../common/responses/FeatureNotEnabled.yml'
'403':
$ref: '../../common/responses/MethodNotAllowed.yml'
'404':
$ref: '../../common/responses/IndexNotFound.yml'
2 changes: 2 additions & 0 deletions specs/abtesting/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,5 @@ paths:
$ref: 'paths/abtest.yml'
/2/abtests/{id}/stop:
$ref: 'paths/stopABTest.yml'
/2/abtests/schedule:
$ref: 'paths/scheduleABTest.yml'
39 changes: 39 additions & 0 deletions tests/CTS/requests/abtesting/scheduleABTest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[
{
"testName": "scheduleABTest with minimal parameters",
"parameters": {
"endAt": "2022-12-31T00:00:00.000Z",
"scheduledAt": "2022-11-31T00:00:00.000Z",
"name": "myABTest",
"variants": [
{
"index": "AB_TEST_1",
"trafficPercentage": 30
},
{
"index": "AB_TEST_2",
"trafficPercentage": 50
}
]
},
"request": {
"path": "/2/abtests/schedule",
"method": "POST",
"body": {
"endAt": "2022-12-31T00:00:00.000Z",
"scheduledAt": "2022-11-31T00:00:00.000Z",
"name": "myABTest",
"variants": [
{
"index": "AB_TEST_1",
"trafficPercentage": 30
},
{
"index": "AB_TEST_2",
"trafficPercentage": 50
}
]
}
}
}
]
Loading