Skip to content

Commit 9aafd69

Browse files
ClaraMullerFluf22
andauthored
fix(specs): invalid API format for multi feed in Comp API (#5993)
Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent e07e37a commit 9aafd69

File tree

3 files changed

+102
-18
lines changed

3 files changed

+102
-18
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ specs/analytics @algolia/optimization
1010
* @algolia/api-clients-automation
1111

1212
specs/composition @algolia/composition
13+
tests/CTS/**/composition @algolia/composition

specs/composition/common/schemas/components/multifeed/Behaviour.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ multifeed:
77
type: object
88
description: A key-value store of Feed ID to Feed. Currently, the only supported Feed type is an Injection.
99
additionalProperties:
10-
$ref: '../injection/Behaviour.yml#/injection'
10+
$ref: '#/feedID'
1111
feedsOrder:
1212
type: array
1313
description: A list of Feed IDs that specifies the order in which to order the results in the response. The IDs should be a subset of those in the Feeds object, and only those specified will be processed. When this field is not set, all Feeds are processed and returned with a default ordering.
@@ -18,24 +18,41 @@ multifeed:
1818
example:
1919
feeds:
2020
products-feed:
21-
main:
22-
source:
23-
search:
24-
index: products
25-
injectedItems:
26-
- key: sponsored
27-
position: 0
28-
length: 4
21+
injection:
22+
main:
2923
source:
3024
search:
3125
index: products
32-
params:
33-
filters: 'sponsored:true'
26+
injectedItems:
27+
- key: sponsored
28+
position: 0
29+
length: 4
30+
source:
31+
search:
32+
index: products
33+
params:
34+
filters: 'sponsored:true'
3435
articles-feed:
35-
main:
36-
source:
37-
search:
38-
index: articles
36+
injection:
37+
main:
38+
source:
39+
search:
40+
index: articles
3941
feedsOrder:
4042
- products-feed
4143
- articles-feed
44+
45+
feedID:
46+
type: object
47+
oneOf:
48+
- $ref: '#/feedInjection' # New behaviour should also be updated here
49+
50+
feedInjection:
51+
type: object
52+
description: 'Feed formatted as an injection.'
53+
additionalProperties: false
54+
properties:
55+
injection:
56+
$ref: '../injection/Behaviour.yml#/injection'
57+
required:
58+
- injection

tests/CTS/requests/composition/putComposition.json

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@
134134
}
135135
},
136136
{
137-
"skipLanguages": ["kotlin"],
137+
"skipLanguages": [
138+
"kotlin"
139+
],
138140
"parameters": {
139141
"compositionID": "my-metadata-compo",
140142
"composition": {
@@ -362,7 +364,6 @@
362364
}
363365
}
364366
},
365-
366367
{
367368
"parameters": {
368369
"compositionID": "my-compo",
@@ -409,5 +410,70 @@
409410
}
410411
}
411412
}
413+
},
414+
{
415+
"parameters": {
416+
"compositionID": "my-compo",
417+
"composition": {
418+
"objectID": "my-compo",
419+
"name": "my composition",
420+
"sortingStrategy": {
421+
"Price-asc": "products-low-to-high",
422+
"Price-desc": "products-high-to-low"
423+
},
424+
"behavior": {
425+
"multifeed": {
426+
"feeds": {
427+
"main-products": {
428+
"injection": {
429+
"main": {
430+
"source": {
431+
"search": {
432+
"index": "products"
433+
}
434+
}
435+
}
436+
}
437+
}
438+
},
439+
"feedsOrder": [
440+
"main-products"
441+
]
442+
}
443+
}
444+
}
445+
},
446+
"request": {
447+
"path": "/1/compositions/my-compo",
448+
"method": "PUT",
449+
"body": {
450+
"objectID": "my-compo",
451+
"name": "my composition",
452+
"sortingStrategy": {
453+
"Price-asc": "products-low-to-high",
454+
"Price-desc": "products-high-to-low"
455+
},
456+
"behavior": {
457+
"multifeed": {
458+
"feeds": {
459+
"main-products": {
460+
"injection": {
461+
"main": {
462+
"source": {
463+
"search": {
464+
"index": "products"
465+
}
466+
}
467+
}
468+
}
469+
}
470+
},
471+
"feedsOrder": [
472+
"main-products"
473+
]
474+
}
475+
}
476+
}
477+
}
412478
}
413-
]
479+
]

0 commit comments

Comments
 (0)