Skip to content

Commit 5c5302b

Browse files
committed
code review fixes
1 parent b3d2e24 commit 5c5302b

File tree

3 files changed

+38
-41
lines changed

3 files changed

+38
-41
lines changed

specs/composition-full/common/params/Composition.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,17 @@ externalInjectedItem:
4646
objectID:
4747
type: string
4848
metadata:
49-
$ref: '../schemas/components/CompositionBehavior.yml#/metadata'
49+
$ref: '#/injectedItemMetadata'
5050
description: |
5151
An objectID injected into an external source.
5252
required:
5353
- objectID
5454
example: {'objectID': 'my-object-1', 'metadata': {'my-field': 'my-value'}}
55+
56+
injectedItemMetadata:
57+
type: object
58+
additionalProperties: true
59+
description: |
60+
User defined key-values that will be added to injected item in the response.
61+
This is identical to Hits metadata which is defined in Composition or Composition Rule, with the benefit of being set at runtime.
62+
example: {'my-value': 'my-field'}

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

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ injectedItem:
5555
description: injected Item unique identifier.
5656
source:
5757
description: Search source to be used to inject items into result set.
58-
$ref: '#/injectionSource'
58+
$ref: '#/injectedItemSource'
5959
position:
6060
type: integer
6161
minimum: 0
@@ -65,32 +65,29 @@ injectedItem:
6565
minimum: 0
6666
maximum: 20
6767
metadata:
68-
$ref: '#/metadata'
68+
title: injectedItemMetadata
69+
type: object
70+
description: Used to add metadata to the results of the injectedItem.
71+
properties:
72+
hits:
73+
title: injectedItemHitsMetadata
74+
type: object
75+
description: Adds the provided metadata to each injected hit via an `_extra` attribute.
76+
properties:
77+
addItemKey:
78+
type: boolean
79+
description: When true, the `_injectedItemKey` field is set in the `_extra` object of each affected hit.
80+
extra:
81+
type: object
82+
additionalProperties: true
83+
description: The user-defined key-value pairs that will be placed in the `_extra` field of each affected hit.
6984
required:
7085
- key
7186
- source
7287
- position
7388
- length
7489

75-
injectionSource:
90+
injectedItemSource:
7691
oneOf:
7792
- $ref: './InjectionSource.yml#/search'
7893
- $ref: './InjectionSource.yml#/external'
79-
80-
metadata:
81-
title: injectedItemMetadata
82-
type: object
83-
description: Used to add metadata to the results of the injectedItem.
84-
properties:
85-
hits:
86-
title: injectedItemHitsMetadata
87-
type: object
88-
description: Adds the provided metadata to each injected hit via an `_extra` attribute.
89-
properties:
90-
addItemKey:
91-
type: boolean
92-
description: When true, the `_injectedItemKey` field is set in the `_extra` object of each affected hit.
93-
extra:
94-
type: object
95-
additionalProperties: true
96-
description: The user-defined key-value pairs that will be placed in the `_extra` field of each affected hit.

specs/composition-full/common/schemas/components/InjectionSource.yml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,27 @@ search:
33
description: Injected items will originate from a search request performed on the specified index.
44
type: object
55
additionalProperties: false
6-
allOf:
7-
- $ref: '#/baseSource'
8-
- type: object
9-
additionalProperties: false
6+
properties:
7+
index:
8+
type: string
9+
description: Composition Index name.
10+
example: Products
11+
params:
12+
$ref: './Injection.yml#/injectedItemsQueryParameters'
13+
required:
14+
- index
1015

1116
external:
1217
title: injectedItemExternalSource
1318
description: Injected items will originate from externally provided objectIDs (that must exist in the index) given at runtime in the run request payload.
1419
type: object
1520
additionalProperties: false
1621
allOf:
17-
- $ref: '#/baseSource'
22+
- $ref: '#/search'
1823
properties:
1924
ordering:
2025
$ref: '#/externalOrdering'
2126

22-
baseSource:
23-
type: object
24-
additionalProperties: false
25-
properties:
26-
index:
27-
type: string
28-
description: Composition Index name.
29-
example: Products
30-
params:
31-
$ref: './Injection.yml#/injectedItemsQueryParameters'
32-
required:
33-
- index
34-
3527
externalOrdering:
36-
enum: ['default', 'user-defined']
28+
enum: ['default', 'userDefined']
3729
default: 'default'

0 commit comments

Comments
 (0)