Skip to content

Commit 5febb5c

Browse files
committed
feat: update composition according to upcoming API changes
1 parent c7d0365 commit 5febb5c

File tree

8 files changed

+129
-31
lines changed

8 files changed

+129
-31
lines changed

specs/common/schemas/SearchResponse.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
baseSearchResponse:
2+
additionalProperties: true
3+
allOf:
4+
- $ref: '#/rootSearchResponse'
5+
- $ref: '#/appliedRulesResponse'
6+
7+
appliedRulesResponse:
8+
type: object
9+
additionalProperties: true
10+
properties:
11+
appliedRules:
12+
description: Rules applied to the query.
13+
title: appliedRules
14+
type: array
15+
items:
16+
type: object
17+
18+
rootSearchResponse:
219
type: object
320
additionalProperties: true
421
required:
@@ -44,12 +61,6 @@ baseSearchResponse:
4461
type: boolean
4562
title: typo
4663
description: Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled.
47-
appliedRules:
48-
description: Rules applied to the query.
49-
title: appliedRules
50-
type: array
51-
items:
52-
type: object
5364
exhaustiveFacetsCount:
5465
type: boolean
5566
description: See the `facetsCount` field of the `exhaustive` object in the response.

specs/composition/common/schemas/Hit.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ compositionRankingInfo:
3232
composed:
3333
title: composedRankingInfo
3434
type: object
35-
additionalProperties: false
36-
properties:
37-
index:
38-
type: string
39-
inset:
40-
type: string
41-
required:
42-
- index
43-
- inset
35+
additionalProperties:
36+
title: compositionIdRankingInfo
37+
type: object
38+
properties:
39+
index:
40+
type: string
41+
injectedItemKey:
42+
type: string
43+
required:
44+
- index
45+
- injectedItemKey

specs/composition/common/schemas/SearchParams.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,8 @@ mainInjectionQueryParameters:
657657
x-categories:
658658
- Filtering
659659

660-
InsetsQueryParameters:
661-
title: Composition Insets Query parameters as object
660+
injectedItemsQueryParameters:
661+
title: Composition injectedItems Query parameters as object
662662
type: object
663663
additionalProperties: false
664664
properties:

specs/composition/common/schemas/SearchResponse.yml

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
searchResponse:
22
additionalProperties: true
33
allOf:
4-
- $ref: '../../../common/schemas/SearchResponse.yml#/baseSearchResponse'
4+
- $ref: '#/compositionRootSearchResponse'
5+
- $ref: '../../../common/schemas/SearchResponse.yml#/rootSearchResponse'
56
- $ref: '#/searchResults'
67

78
searchResults:
@@ -16,6 +17,7 @@ searchResults:
1617

1718
searchResultsItem:
1819
allOf:
20+
- $ref: '#/resultsCompositionsResponse'
1921
- $ref: '#/searchHits'
2022
- $ref: '../../../common/schemas/SearchResponse.yml#/SearchPagination'
2123

@@ -33,3 +35,80 @@ searchHits:
3335
$ref: 'Hit.yml#/hit'
3436
required:
3537
- hits
38+
39+
resultsCompositionsResponse:
40+
type: object
41+
additionalProperties: true
42+
properties:
43+
compositions:
44+
title: resultsCompositionsInfoResponse
45+
type: object
46+
additionalProperties:
47+
title: resultsCompositionInfoResponse
48+
type: object
49+
properties:
50+
injectedItems:
51+
type: array
52+
items:
53+
$ref: '#/resultsInjectedItemInfoResponse'
54+
required:
55+
- injectedItems
56+
required:
57+
- compositions
58+
59+
resultsInjectedItemInfoResponse:
60+
type: object
61+
additionalProperties: true
62+
properties:
63+
key:
64+
type: string
65+
appliedRules:
66+
type: array
67+
items:
68+
title: resultsInjectedItemAppliedRulesInfoResponse
69+
type: object
70+
properties:
71+
objectID:
72+
$ref: '../../../common/parameters.yml#/objectID'
73+
required:
74+
- objectID
75+
required:
76+
- key
77+
78+
compositionRootSearchResponse:
79+
type: object
80+
additionalProperties: true
81+
properties:
82+
compositions:
83+
$ref: '#/compositionBaseSearchResponse'
84+
85+
compositionBaseSearchResponse:
86+
type: object
87+
additionalProperties: true
88+
properties:
89+
run:
90+
type: array
91+
items:
92+
$ref: '#/compositionRunSearchResponse'
93+
required:
94+
- run
95+
96+
compositionRunSearchResponse:
97+
type: object
98+
additionalProperties: true
99+
properties:
100+
objectID:
101+
$ref: '../../../common/parameters.yml#/objectID'
102+
appliedRules:
103+
type: array
104+
items:
105+
title: compositionRunAppliedRules
106+
type: object
107+
properties:
108+
objectID:
109+
$ref: '../../../common/parameters.yml#/objectID'
110+
required:
111+
- objectID
112+
required:
113+
- objectID
114+
- appliedRules

specs/composition/common/schemas/compositionBehavior.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,32 @@ compositionBehavior:
3434
- search
3535
required:
3636
- source
37-
insets:
37+
injectedItems:
3838
type: array
39-
description: list of insets of the current Composition.
39+
description: list of injected items of the current Composition.
4040
minItems: 0
4141
maxItems: 2
4242
items:
43-
$ref: '#/compositionInset'
43+
$ref: '#/injectedItem'
4444
required:
4545
- main
4646
required:
4747
- injection
4848

49-
compositionInset:
49+
injectedItem:
5050
type: object
5151
additionalProperties: false
5252
properties:
53-
name:
53+
key:
5454
type: string
55-
description: Inset name.
55+
description: injected Item unique identifier.
5656
source:
57-
title: compositionInsetSource
57+
title: injectedItemSource
5858
type: object
5959
additionalProperties: false
6060
properties:
6161
search:
62-
title: compositionInsetSourceSearch
62+
title: injectedItemSourceSearch
6363
type: object
6464
additionalProperties: false
6565
properties:
@@ -68,7 +68,7 @@ compositionInset:
6868
description: Composition Main Index name.
6969
example: Products
7070
params:
71-
$ref: './SearchParams.yml#/InsetsQueryParameters'
71+
$ref: './SearchParams.yml#/injectedItemsQueryParameters'
7272
required:
7373
- index
7474
required:
@@ -82,7 +82,7 @@ compositionInset:
8282
minimum: 0
8383
maximum: 20
8484
required:
85-
- name
85+
- key
8686
- source
8787
- position
8888
- length

specs/composition/common/schemas/listCompositionsResponse.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ composition:
2121
properties:
2222
objectID:
2323
$ref: '../../../common/parameters.yml#/objectID'
24-
description:
24+
name:
2525
type: string
2626
description: Composition name.
2727
example: 'my lovely crafted composition'
28+
description:
29+
type: string
30+
description: Composition description.
31+
example: 'my lovely crafted composition that is used for X purpose'
2832
behavior:
2933
$ref: './compositionBehavior.yml#/compositionBehavior'
3034
required:
3135
- objectID
3236
- behavior
37+
- name

tests/CTS/requests/composition/listCompositions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"items": [
1919
{
2020
"objectID": "id1",
21+
"name": "my first composition",
2122
"description": "the first ever composition from the client",
2223
"behavior": {
2324
"injection": {

tests/CTS/requests/composition/multipleBatch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
}
1717
},
18-
"insets": []
18+
"injectedItems": []
1919
}
2020
}
2121
}
@@ -38,7 +38,7 @@
3838
"body": {
3939
"behavior": {
4040
"injection": {
41-
"insets": [],
41+
"injectedItems": [],
4242
"main": {
4343
"source": {
4444
"search": {

0 commit comments

Comments
 (0)