Skip to content

Commit 156fd9e

Browse files
kai687millotpshortcuts
authored
feat(specs): improve API reference documentation (#2831)
Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 1f56734 commit 156fd9e

Some content is hidden

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

72 files changed

+1730
-742
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"scripts:test": "yarn workspace scripts test",
2525
"specs:fix": "eslint --ext=yml specs/$0 --fix",
2626
"specs:lint": "eslint --ext=yml specs/$0",
27-
"website": "yarn cli build specs all -s && cd website && yarn start",
27+
"website": "yarn cli build specs all -d -s && cd website && yarn start",
2828
"website:build": "bash scripts/website/build.sh"
2929
},
3030
"devDependencies": {

specs/common/parameters.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
IndexName:
33
name: indexName
44
in: path
5-
description: Index on which to perform the request.
5+
description: Name of the index on which to perform the operation.
66
required: true
77
schema:
88
type: string
9-
example: myIndexName
9+
example: YourIndexName
1010

1111
ObjectID:
1212
name: objectID
1313
in: path
14-
description: Unique record (object) identifier.
14+
description: Unique record identifier.
1515
required: true
1616
schema:
1717
type: string
@@ -21,7 +21,7 @@ ObjectID:
2121
Index:
2222
in: query
2323
name: index
24-
description: Index name to target.
24+
description: Index name.
2525
required: true
2626
schema:
2727
type: string
@@ -30,33 +30,34 @@ Index:
3030
StartDate:
3131
in: query
3232
name: startDate
33-
description: Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
33+
description: Start date (`YYYY-MM-DD`) of the period to analyze.
3434
schema:
3535
type: string
36+
format: date
3637
example: 2022-09-19
37-
pattern: ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
3838

3939
EndDate:
4040
in: query
4141
name: endDate
42-
description: End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
42+
description: End date (`YYYY-MM-DD`) of the period to analyze.
4343
schema:
4444
type: string
45+
format: date
4546
example: 2023-01-21
46-
pattern: ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
4747

4848
ForwardToReplicas:
4949
in: query
5050
name: forwardToReplicas
51-
description: Indicates whether changed index settings are forwarded to the replica indices.
51+
description: Whether changes are applied to replica indices.
5252
schema:
5353
type: boolean
5454

5555
Page:
5656
in: query
5757
name: page
58-
description: >
59-
Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated.
58+
description: |
59+
Requested page of the API response.
60+
If `null`, the API response is not paginated.
6061
schema:
6162
type: integer
6263
minimum: 0
@@ -66,8 +67,9 @@ Page:
6667
PageDefault0:
6768
in: query
6869
name: page
69-
description: >
70-
Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there's no pagination.
70+
description: |
71+
Requested page of the API response.
72+
If `null`, the API response is not paginated.
7173
schema:
7274
type: integer
7375
nullable: true
@@ -77,32 +79,37 @@ PageDefault0:
7779
HitsPerPage:
7880
in: query
7981
name: hitsPerPage
80-
description: Maximum number of hits per page.
82+
description: Number of hits per page.
8183
schema:
8284
type: integer
8385
default: 100
8486

8587
Offset:
8688
in: query
8789
name: offset
88-
description: Position of the starting record. Used for paging. 0 is the first record.
90+
description: Position of the first item to return.
8991
schema:
9092
type: integer
9193
default: 0
94+
minimum: 0
9295

9396
Limit:
9497
in: query
9598
name: limit
96-
description: Number of records to return (page size).
99+
description: Number of items to return.
97100
schema:
98101
type: integer
99102
default: 10
100103

101104
# misc
102105
objectID:
103106
type: string
104-
description: Unique object identifier.
105-
example: 'product-1'
107+
description: Unique record identifier.
108+
109+
ruleID:
110+
title: objectID
111+
type: string
112+
description: Unique identifier of a rule object.
106113

107114
id:
108115
type: string
@@ -112,7 +119,7 @@ id:
112119
indexName:
113120
type: string
114121
example: products
115-
description: Algolia index name.
122+
description: Index name.
116123

117124
hitsPerPage:
118125
type: integer
@@ -123,13 +130,13 @@ hitsPerPage:
123130

124131
query:
125132
type: string
126-
description: Full-text query.
133+
description: Search query.
127134
default: ''
128135

129136
page:
130137
type: integer
131138
minimum: 0
132-
description: Requested page (the first page is page 0).
139+
description: Requested page of the API response.
133140

134141
trackedSearchCount:
135142
type: integer

specs/common/responses/common.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@ taskID:
22
type: integer
33
format: int64
44
example: 1514562690001
5-
description: >
5+
description: |
66
Unique identifier of a task.
77
8-
A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`.
8+
A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the [`task` operation](#tag/Indices/operation/getTask) and this `taskID`.
99
1010
objectIDs:
1111
type: array
1212
items:
1313
type: string
14-
example: ['record-1','record-2']
15-
description: Unique object (record) identifiers.
14+
example:
15+
- record-1
16+
- record-2
17+
description: Unique record identifiers.
1618

1719
createdAt:
1820
type: string
19-
example: '2023-07-04T12:49:15Z'
20-
description: Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.
21+
example: 2023-07-04T12:49:15Z
22+
description: Timestamp of creation in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.
2123

2224
createdAtTimestamp:
2325
type: integer
@@ -27,10 +29,10 @@ createdAtTimestamp:
2729

2830
updatedAt:
2931
type: string
30-
example: '2023-07-04T12:49:15Z'
32+
example: 2023-07-04T12:49:15Z
3133
description: Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.
3234

3335
deletedAt:
3436
type: string
35-
example: '2023-06-27T14:42:38.831Z'
37+
example: 2023-06-27T14:42:38.831Z
3638
description: Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.

specs/common/schemas/HighlightResult.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
highlightResultOption:
22
type: object
3-
description: Show highlighted section and words matched on a query.
3+
description: Surround words that match the query with HTML tags for highlighting.
44
additionalProperties: false
55
properties:
66
value:
@@ -9,7 +9,7 @@ highlightResultOption:
99
$ref: '#/matchLevel'
1010
matchedWords:
1111
type: array
12-
description: List of words from the query that matched the object.
12+
description: List of matched words from the search query.
1313
example: ['action']
1414
items:
1515
type: string
@@ -23,23 +23,24 @@ highlightResultOption:
2323

2424
highlightedValue:
2525
type: string
26-
description: Markup text with `facetQuery` matches highlighted.
26+
description: Highlighted attribute value, including HTML tags.
2727
example: '<em>George</em> <em>Clo</em>oney'
2828

2929
matchLevel:
3030
type: string
31-
description: Indicates how well the attribute matched the search query.
31+
description: Whether the whole query string matches or only a part.
3232
enum: [none, partial, full]
3333

3434
highlightResultOptionMap:
3535
type: object
36-
description: Show highlighted section and words matched on a query.
36+
description: Surround words that match the query with HTML tags for highlighting.
3737
additionalProperties:
38+
x-additionalPropertiesName: attribute
3839
$ref: '#/highlightResultOption'
3940

4041
highlightResultOptionArray:
4142
type: array
42-
description: Show highlighted section and words matched on a query.
43+
description: Surround words that match the query with HTML tags for highlighting.
4344
items:
4445
$ref: '#/highlightResultOption'
4546

@@ -51,6 +52,7 @@ highlightResult:
5152

5253
highlightResultMap:
5354
type: object
54-
description: Show highlighted section and words matched on a query.
55+
description: Surround words that match the query with HTML tags for highlighting.
5556
additionalProperties:
57+
x-additionalPropertiesName: attribute
5658
$ref: '#/highlightResult'

0 commit comments

Comments
 (0)