Skip to content

Commit f15457f

Browse files
gazconroykai687shortcuts
authored
feat(specs): Review OpenAPI common specs (#1692)
Co-authored-by: Kai Welke <kai.welke@algolia.com> Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
1 parent 550313a commit f15457f

File tree

122 files changed

+1326
-616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1326
-616
lines changed

.eslintrc.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ module.exports = {
132132
},
133133
},
134134
],
135+
'jsdoc/match-description':[
136+
'error',
137+
{
138+
matchDescription: '^\n?([A-Z`\[\\d_][\\s\\S]*[.?!`]\\s*)?$'
139+
},
140+
],
135141
},
136142
},
137143
// JS client rules

.github/.cache_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.4
1+
0.0.5

specs/abtesting/common/parameters.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,49 @@
22
ID:
33
in: path
44
name: id
5-
description: The A/B test ID.
5+
description: Unique A/B test ID.
66
required: true
77
schema:
88
type: integer
9+
example: 390
910

1011
# misc
1112
index:
1213
type: string
13-
description: The index performing the A/B test.
14+
description: A/B test index.
15+
example: 'delcourt_production'
1416

1517
abTestID:
1618
type: integer
17-
description: The A/B test ID.
19+
description: Unique A/B test ID.
20+
example: 224
1821

1922
endAt:
2023
type: string
21-
description: End date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ.
24+
description: End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.
25+
example: '2023-06-17T00:00:00Z'
2226

2327
createdAt:
2428
type: string
25-
description: Creation date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ.
29+
description: Creation date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.
30+
example: '2023-06-15T15:06:04.249906Z'
2631

2732
updatedAt:
2833
type: string
29-
description: Update date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ.
34+
description: Update date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.
35+
example: '2023-06-15T15:06:44.400601Z'
3036

3137
name:
3238
type: string
3339
description: A/B test name.
40+
example: 'Custom ranking sales rank test'
3441

3542
description:
3643
type: string
37-
description: The A/B test description.
44+
description: A/B test description.
45+
example: 'Current production index'
3846

3947
trafficPercentage:
4048
type: integer
41-
description: The traffic percentage for the A/B test.
49+
description: A/B test traffic percentage.
50+
example: 60

specs/abtesting/common/schemas/ABTest.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ABTests:
22
type: array
3-
description: List of A/B tests.
3+
description: A/B tests.
44
items:
55
$ref: '#/ABTest'
66

@@ -13,12 +13,14 @@ ABTest:
1313
clickSignificance:
1414
type: number
1515
format: double
16-
description: A/B test significance based on click data. Should be > 0.95 to be considered significant (no matter which variant is winning).
16+
description: >
17+
[A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on click data. A value of 0.95 or over is considered to be _significant_.
18+
example: 1
1719
conversionSignificance:
1820
type: number
1921
format: double
20-
description: A/B test significance based on conversion data. Should be > 0.95 to be considered significant (no matter which variant is winning).
21-
endAt:
22+
description: >
23+
[A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on conversion. A value of 0.95 or over is considered to be _significant_.
2224
$ref: '../parameters.yml#/endAt'
2325
updatedAt:
2426
$ref: '../parameters.yml#/updatedAt'
@@ -28,7 +30,8 @@ ABTest:
2830
$ref: '../parameters.yml#/name'
2931
status:
3032
type: string
31-
description: status of the A/B test.
33+
description: A/B test status.
34+
example: 'running'
3235
variants:
3336
$ref: 'Variant.yml#/variants'
3437
required:

specs/abtesting/common/schemas/AddABTestsVariant.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abTestsVariant:
2424

2525
customSearchParams:
2626
type: object
27+
description: Applies search parameters from [a restricted set of options](https://www.algolia.com/doc/api-reference/api-methods/add-ab-test/#method-param-customsearchparameters). Only use this parameter if the two variants use the same index.
28+
example: {'typoTolerance': false,'synonyms': false}
2729
additionalProperties: false
2830
properties:
2931
customSearchParameters:

specs/abtesting/common/schemas/Variant.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variants:
22
type: array
3-
description: List of A/B test variant.
3+
description: A/B test variants.
44
items:
55
$ref: '#/variant'
66

@@ -10,43 +10,54 @@ variant:
1010
properties:
1111
averageClickPosition:
1212
type: integer
13-
description: Average click position for the variant.
13+
description: Variant's [average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position).
14+
example: 0
1415
clickCount:
1516
type: integer
16-
description: Distinct click count for the variant.
17+
description: Number of click events for this variant.
18+
example: 65131
1719
clickThroughRate:
1820
type: number
1921
format: double
20-
description: Click through rate for the variant.
22+
description: Variant's [click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).
23+
example: 0.22219857724813036
2124
conversionCount:
2225
type: integer
23-
description: Distinct conversion count for the variant.
26+
description: Number of click events for this variant.
27+
example: 4785
2428
conversionRate:
2529
type: number
2630
format: double
27-
description: Conversion rate for the variant.
31+
description: Variant's [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).
32+
example: 0.14546725846658964
2833
description:
2934
$ref: '../parameters.yml#/description'
3035
index:
3136
$ref: '../parameters.yml#/index'
3237
noResultCount:
33-
$ref: '../../../common/parameters.yml#/count'
38+
type: integer
39+
description: Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for that variant.
40+
example: 0
3441
outlierTrackedSearchesCount:
3542
type: integer
36-
description: Count of the tracked searches attributed to outlier traffic that were removed from the A/B test.
43+
description: Number of tracked searches attributed to [outlier traffic](https://www.algolia.com/doc/guides/ab-testing/how-to-read-your-a-b-test-results/#is-the-split-off) that were removed from the A/B test. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`.
44+
example: 0
3745
outlierUsersCount:
3846
type: integer
39-
description: Count of users attributed to outlier traffic that were removed from the A/B test.
47+
description: Number of users attributed to [outlier traffic](https://www.algolia.com/doc/guides/ab-testing/how-to-read-your-a-b-test-results/#is-the-split-off) that were removed from the A/B test.
48+
example: 0
4049
searchCount:
4150
type: integer
42-
description: The number of search during the A/B test.
51+
description: Number of searches carried out during the A/B test.
52+
example: 86269
4353
trackedSearchCount:
4454
$ref: '../../../common/parameters.yml#/trackedSearchCount'
4555
trafficPercentage:
4656
$ref: '../parameters.yml#/trafficPercentage'
4757
userCount:
4858
type: integer
49-
description: The number of user during the A/B test.
59+
description: Number of users during the A/B test.
60+
example: 55501
5061
required:
5162
- userCount
5263
- trafficPercentage

specs/abtesting/paths/abtest.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ get:
22
tags:
33
- abtest
44
operationId: getABTest
5-
summary: Get a test.
5+
summary: Get A/B test details.
66
description: >
7-
Returns metadata and metrics for an A/B test.
7+
Get specific details for an A/B test.
8+
9+
To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
810
parameters:
911
- $ref: '../common/parameters.yml#/ID'
1012
responses:
@@ -27,8 +29,11 @@ delete:
2729
tags:
2830
- abtest
2931
operationId: deleteABTest
30-
summary: Delete a test.
31-
description: Delete a test.
32+
summary: Delete an A/B test.
33+
description: >
34+
Delete an A/B test.
35+
36+
To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
3237
parameters:
3338
- $ref: '../common/parameters.yml#/ID'
3439
responses:

specs/abtesting/paths/abtests.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ post:
22
tags:
33
- abtest
44
operationId: addABTests
5-
summary: Create a test.
6-
description: >
7-
Creates a new A/B test with provided configuration.
8-
9-
You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants.
5+
summary: Create an A/B test.
6+
description: Creates an A/B test.
107
requestBody:
118
required: true
129
content:
@@ -18,9 +15,9 @@ post:
1815
properties:
1916
name:
2017
$ref: '../common/parameters.yml#/name'
21-
variant:
18+
variants:
2219
type: array
23-
description: List of 2 variants for the A/B test.
20+
description: A/B test variants.
2421
minItems: 2
2522
maxItems: 2
2623
items:
@@ -29,7 +26,7 @@ post:
2926
$ref: '../common/parameters.yml#/endAt'
3027
required:
3128
- name
32-
- variant
29+
- variants
3330
- endAt
3431
responses:
3532
'200':
@@ -51,22 +48,21 @@ get:
5148
tags:
5249
- abtest
5350
operationId: listABTests
54-
summary: List all tests.
55-
description: >
56-
Fetch all existing A/B tests for App that are available for the current API Key.
57-
58-
When no data has been processed, the metrics will be returned as null.
51+
summary: List all A/B tests.
52+
description: List all A/B tests.
5953
parameters:
6054
- $ref: '../../common/parameters.yml#/Offset'
6155
- $ref: '../../common/parameters.yml#/Limit'
6256
- name: indexPrefix
6357
in: query
64-
description: Filters the returned ab tests by any indices starting with the provided prefix that are assigned to either variant of an ab test.
58+
description: Only return A/B tests for indices starting with this prefix.
59+
example: 'dev_'
6560
schema:
6661
type: string
6762
- name: indexSuffix
6863
in: query
69-
description: Filters the returned ab tests by any indices ending with the provided suffix that are assigned to either variant of an ab test.
64+
description: Only return A/B tests for indices ending with this suffix.
65+
example: '_development'
7066
schema:
7167
type: string
7268
responses:
@@ -83,10 +79,12 @@ get:
8379
$ref: '../common/schemas/ABTest.yml#/ABTests'
8480
count:
8581
type: integer
86-
description: Number of A/B tests found for the app.
82+
description: Number of A/B tests implemented.
83+
example: 10
8784
total:
8885
type: integer
89-
description: Number of A/B tests retrievable.
86+
description: Number of retrievable A/B tests.
87+
example: 12
9088
required:
9189
- abtests
9290
- count

specs/abtesting/paths/stopABTest.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ post:
22
tags:
33
- abtest
44
operationId: stopABTest
5-
summary: Stop a test.
5+
summary: Stop an A/B test.
66
description: >
7-
Marks the A/B test as stopped.
7+
If stopped, the test is over and can't be restarted.
8+
There is now only one index, receiving 100% of all search requests.
9+
10+
The data gathered for stopped A/B tests is retained.
811
9-
At this point, the test is over and cannot be restarted.
10-
As a result, your application is back to normal: index A will perform as usual, receiving 100% of all search requests.
11-
Associated metadata and metrics are still stored.
12+
To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
1213
parameters:
1314
- $ref: '../common/parameters.yml#/ID'
1415
responses:

specs/abtesting/spec.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ security:
2323
apiKey: []
2424
tags:
2525
- name: abtest
26-
x-displayName: A/B Testing
27-
description: Manage A/B Tests.
26+
x-displayName: A/B testing
27+
description: Manage A/B tests.
2828
x-tagGroups:
2929
- name: General
3030
tags:

0 commit comments

Comments
 (0)