Skip to content

Commit 3d93cf1

Browse files
committed
add deduplication field
1 parent fc8c489 commit 3d93cf1

File tree

2 files changed

+98
-3
lines changed

2 files changed

+98
-3
lines changed

specs/composition/common/schemas/components/CompositionBehavior.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ compositionBehavior:
4141
maxItems: 2
4242
items:
4343
$ref: '#/injectedItem'
44+
deduplication:
45+
title: deduplication
46+
type: object
47+
additionalProperties: false
48+
description: Deduplication configures the method used to remove the same items from injected groups and main search.
49+
properties:
50+
positioning:
51+
$ref: '#/dedupPositioning'
4452
required:
4553
- main
4654
required:
@@ -91,3 +99,17 @@ injectedItemSource:
9199
oneOf:
92100
- $ref: './InjectionSource.yml#/SearchSource'
93101
- $ref: './InjectionSource.yml#/ExternalSource'
102+
103+
dedupPositioning:
104+
type: string
105+
enum:
106+
- highest
107+
- highestInjected
108+
description: |
109+
Deduplication setting to determine duplicate object resolution.
110+
highest:
111+
- Will keep the item in the highest position if a duplicate is found.
112+
highestInjected:
113+
- Keeps the item at its highest possible injected position, even if main might be higher.
114+
example: highest
115+
default: highestInjected

tests/CTS/requests/composition/putComposition.json

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@
134134
}
135135
},
136136
{
137-
"skipLanguages": [
138-
"kotlin"
139-
],
137+
"skipLanguages": ["kotlin"],
140138
"parameters": {
141139
"compositionID": "my-metadata-compo",
142140
"composition": {
@@ -288,5 +286,80 @@
288286
}
289287
}
290288
}
289+
},
290+
{
291+
"parameters": {
292+
"compositionID": "my-compo",
293+
"composition": {
294+
"objectID": "my-compo",
295+
"name": "my composition",
296+
"behavior": {
297+
"injection": {
298+
"main": {
299+
"source": {
300+
"search": {
301+
"index": "foo",
302+
"params": {
303+
"filters": "brand:adidas"
304+
}
305+
}
306+
}
307+
},
308+
"injectedItems": [
309+
{
310+
"key": "injectedItem1",
311+
"source": {
312+
"search": {
313+
"index": "foo"
314+
}
315+
},
316+
"position": 2,
317+
"length": 1
318+
}
319+
],
320+
"deduplication": {
321+
"positioning": "highest"
322+
}
323+
}
324+
}
325+
}
326+
},
327+
"request": {
328+
"path": "/1/compositions/my-compo",
329+
"method": "PUT",
330+
"body": {
331+
"objectID": "my-compo",
332+
"name": "my composition",
333+
"behavior": {
334+
"injection": {
335+
"main": {
336+
"source": {
337+
"search": {
338+
"index": "foo",
339+
"params": {
340+
"filters": "brand:adidas"
341+
}
342+
}
343+
}
344+
},
345+
"injectedItems": [
346+
{
347+
"key": "injectedItem1",
348+
"source": {
349+
"search": {
350+
"index": "foo"
351+
}
352+
},
353+
"position": 2,
354+
"length": 1
355+
}
356+
],
357+
"deduplication": {
358+
"positioning": "highest"
359+
}
360+
}
361+
}
362+
}
363+
}
291364
}
292365
]

0 commit comments

Comments
 (0)