Skip to content

Commit 9e146d0

Browse files
algolia-bote-krebsshortcuts
committed
feat(specs): improve Composition Client searchResponse specs (matches SearchClient more closely for IS) (#4300) (generated) [skip ci]
Co-authored-by: Emmanuel Krebs <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 784e40a commit 9e146d0

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

clients/algoliasearch-client-javascript/packages/client-composition/model/searchHits.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,14 @@ export type SearchHits<T = Record<string, unknown>> = Record<string, any> & {
77
* Search results (hits). Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
88
*/
99
hits: Hit<T>[];
10+
11+
/**
12+
* Search query.
13+
*/
14+
query: string;
15+
16+
/**
17+
* URL-encoded string of all search parameters.
18+
*/
19+
params: string;
1020
};

clients/algoliasearch-client-javascript/packages/client-composition/model/searchPagination.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ export type SearchPagination = {
44
/**
55
* Page of search results to retrieve.
66
*/
7-
page?: number;
7+
page: number;
88

99
/**
1010
* Number of results (hits).
1111
*/
12-
nbHits?: number;
12+
nbHits: number;
1313

1414
/**
1515
* Number of pages of results.
1616
*/
17-
nbPages?: number;
17+
nbPages: number;
1818

1919
/**
2020
* Number of hits per page.
2121
*/
22-
hitsPerPage?: number;
22+
hitsPerPage: number;
2323
};

clients/algoliasearch-client-javascript/packages/client-composition/model/searchResults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export type SearchResults<T = Record<string, unknown>> = {
66
/**
77
* Search results.
88
*/
9-
results?: SearchResultsItem<T>[];
9+
results: SearchResultsItem<T>[];
1010
};

docs/bundled/composition.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,11 @@ components:
20412041
$ref: '#/components/schemas/nbPages'
20422042
hitsPerPage:
20432043
$ref: '#/components/schemas/hitsPerPage'
2044+
required:
2045+
- page
2046+
- nbHits
2047+
- nbPages
2048+
- hitsPerPage
20442049
highlightedValue:
20452050
type: string
20462051
description: Highlighted attribute value, including HTML tags.
@@ -2280,8 +2285,16 @@ components:
22802285
augmented with additional attributes, such as, for highlighting.
22812286
items:
22822287
$ref: '#/components/schemas/hit'
2288+
query:
2289+
$ref: '#/components/schemas/query'
2290+
params:
2291+
type: string
2292+
description: URL-encoded string of all search parameters.
2293+
example: query=a&hitsPerPage=20
22832294
required:
22842295
- hits
2296+
- query
2297+
- params
22852298
resultsInjectedItemInfoResponse:
22862299
type: object
22872300
additionalProperties: true
@@ -2334,6 +2347,8 @@ components:
23342347
description: Search results.
23352348
items:
23362349
$ref: '#/components/schemas/searchResultsItem'
2350+
required:
2351+
- results
23372352
searchResponse:
23382353
additionalProperties: true
23392354
allOf:

specs/bundled/composition.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,11 @@ components:
17631763
$ref: '#/components/schemas/nbPages'
17641764
hitsPerPage:
17651765
$ref: '#/components/schemas/hitsPerPage'
1766+
required:
1767+
- page
1768+
- nbHits
1769+
- nbPages
1770+
- hitsPerPage
17661771
highlightedValue:
17671772
type: string
17681773
description: Highlighted attribute value, including HTML tags.
@@ -2002,8 +2007,16 @@ components:
20022007
augmented with additional attributes, such as, for highlighting.
20032008
items:
20042009
$ref: '#/components/schemas/hit'
2010+
query:
2011+
$ref: '#/components/schemas/query'
2012+
params:
2013+
type: string
2014+
description: URL-encoded string of all search parameters.
2015+
example: query=a&hitsPerPage=20
20052016
required:
20062017
- hits
2018+
- query
2019+
- params
20072020
resultsInjectedItemInfoResponse:
20082021
type: object
20092022
additionalProperties: true
@@ -2056,6 +2069,8 @@ components:
20562069
description: Search results.
20572070
items:
20582071
$ref: '#/components/schemas/searchResultsItem'
2072+
required:
2073+
- results
20592074
searchResponse:
20602075
additionalProperties: true
20612076
allOf:

0 commit comments

Comments
 (0)