Skip to content

Commit f8dbca1

Browse files
committed
refactor(specs): group everything under the same field
1 parent 8f8a9d2 commit f8dbca1

File tree

3 files changed

+178
-101
lines changed

3 files changed

+178
-101
lines changed
Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
searchResponse:
22
additionalProperties: true
33
allOf:
4-
- $ref: '#/compositionBaseSearchResponse'
4+
- $ref: './runResponseComponents/CompositionsRunSection.yml#/compositionBaseSearchResponse'
55
- $ref: '#/searchResults'
66

77
searchResults:
@@ -15,43 +15,3 @@ searchResults:
1515
$ref: './runResponseComponents/SingleResultSet.yml#/searchResultsItem'
1616
required:
1717
- results
18-
19-
# copy of specs/common/schemas/SearchResponse.yml/#baseSearchResponse without appliedRules
20-
compositionBaseSearchResponse:
21-
type: object
22-
additionalProperties: true
23-
required:
24-
- processingTimeMS
25-
properties:
26-
compositions:
27-
$ref: '#/compositionsSearchResponse'
28-
29-
compositionsSearchResponse:
30-
type: object
31-
additionalProperties: true
32-
properties:
33-
run:
34-
type: array
35-
items:
36-
$ref: '#/compositionRunSearchResponse'
37-
required:
38-
- run
39-
40-
compositionRunSearchResponse:
41-
type: object
42-
additionalProperties: true
43-
properties:
44-
objectID:
45-
$ref: '../../../../common/parameters.yml#/objectID'
46-
appliedRules:
47-
type: array
48-
items:
49-
title: compositionRunAppliedRules
50-
type: object
51-
properties:
52-
objectID:
53-
$ref: '../../../../common/parameters.yml#/objectID'
54-
required:
55-
- objectID
56-
required:
57-
- objectID
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Schema for the compositions section in a composition run response.
2+
# {
3+
# ...
4+
# "compositions": {
5+
# "run": [
6+
# {
7+
# "objectID": "comp1765458818347",
8+
# "appliedRules": [
9+
# {
10+
# "objectID": "cr-1765458959657"
11+
# }
12+
# ]
13+
# }
14+
# ]
15+
# }
16+
# }
17+
18+
compositionBaseSearchResponse:
19+
type: object
20+
properties:
21+
compositions:
22+
$ref: '#/compositionsSearchResponse'
23+
24+
compositionsSearchResponse:
25+
type: object
26+
properties:
27+
run:
28+
type: array
29+
items:
30+
$ref: '#/compositionRunSearchResponse'
31+
required:
32+
- run
33+
34+
compositionRunSearchResponse:
35+
type: object
36+
properties:
37+
objectID:
38+
type: string
39+
description: The objectID of the composition which generated this result set.
40+
appliedRules:
41+
type: array
42+
items:
43+
$ref: '#/compositionRunAppliedRules'
44+
example: {objectID: 'comp1765458818347', appliedRules: [{objectID: 'cr-1765458959657'}]}
45+
required:
46+
- objectID
47+
48+
compositionRunAppliedRules:
49+
type: object
50+
properties:
51+
objectID:
52+
type: string
53+
description: The objectID of the applied composition rule on this query.
54+
example:
55+
objectID: 'cr-1765458959657'
56+
required:
57+
- objectID
Lines changed: 120 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,157 @@
1+
# Schema for a single result set in a composition run response.
2+
# {
3+
# "results": [
4+
# {
5+
# "hits": [
6+
# { ... },
7+
# { ... }
8+
# ],
9+
# "compositions": {
10+
# "comp1765458818347": {
11+
# "injectedItems": [
12+
# {
13+
# "key": "men-sponsored-group",
14+
# "appliedRules": [
15+
# {
16+
# "objectID": "qr-1765459001234"
17+
# }
18+
# ],
19+
# "aiReRanking": { # Not described in the client
20+
# "reRankingActivated": true, # at the moment
21+
# "persoImpactInsideActivationWindow": false
22+
# }
23+
# }
24+
# ]
25+
# }
26+
# }
27+
# },
28+
# ...
29+
# ],
30+
# ...
31+
# }
32+
133
searchResultsItem:
234
allOf:
335
- $ref: '../../../../../common/schemas/SearchResponse.yml#/baseSearchResponse'
4-
- $ref: '#/SearchPagination'
5-
- $ref: '#/searchHits'
36+
- $ref: '#/SearchFields'
637
- $ref: '#/resultsCompositionsResponse'
738

8-
SearchPagination:
39+
SearchFields:
940
type: object
1041
additionalProperties: false
1142
properties:
12-
page:
13-
type: integer
14-
description: The current page of the results.
15-
example: 0
43+
hits:
44+
$ref: '#/hits'
45+
hitsPerPage:
46+
$ref: '#/hitsPerPage'
1647
nbHits:
17-
type: integer
18-
description: Number of results (hits).
19-
example: 20
48+
$ref: '#/nbHits'
2049
nbPages:
21-
type: integer
22-
description: Number of pages of results.
23-
example: 1
24-
hitsPerPage:
25-
type: integer
26-
description: Number of hits returned per page.
27-
example: 20
50+
$ref: '#/nbPages'
51+
page:
52+
$ref: '#/page'
53+
params:
54+
$ref: '#/params'
55+
query:
56+
$ref: '#/query'
2857
required:
2958
- page
3059
- nbHits
3160
- nbPages
3261
- hitsPerPage
33-
34-
searchHits:
35-
type: object
36-
additionalProperties: true
37-
properties:
38-
hits:
39-
type: array
40-
description: |
41-
Search results (hits).
42-
43-
Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
44-
items:
45-
$ref: 'Hit.yml#/hit'
46-
query:
47-
type: string
48-
description: The search query string.
49-
example: shoes
50-
params:
51-
type: string
52-
description: URL-encoded string of all search parameters.
53-
example: query=a&hitsPerPage=20
54-
required:
5562
- hits
5663
- query
5764
- params
5865

66+
# ######################
67+
# # Search Properties ##
68+
# ######################
69+
70+
page:
71+
type: integer
72+
description: The current page of the results.
73+
example: 0
74+
75+
nbHits:
76+
type: integer
77+
description: Number of results (hits).
78+
example: 20
79+
80+
nbPages:
81+
type: integer
82+
description: Number of pages of results.
83+
example: 1
84+
85+
hitsPerPage:
86+
type: integer
87+
description: Number of hits returned per page.
88+
example: 20
89+
90+
hits:
91+
type: array
92+
description: |
93+
Search results (hits).
94+
95+
Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
96+
items:
97+
$ref: 'Hit.yml#/hit'
98+
99+
query:
100+
type: string
101+
description: The search query string.
102+
example: shoes
103+
104+
params:
105+
type: string
106+
description: URL-encoded string of all search parameters.
107+
example: query=a&hitsPerPage=20
108+
109+
# ############################
110+
# # Composition Properties ##
111+
# ###########################
112+
59113
resultsCompositionsResponse:
60114
type: object
61-
additionalProperties: true
62115
properties:
63116
compositions:
64-
title: resultsCompositionsInfoResponse
65-
type: object
66117
additionalProperties:
67-
title: resultsCompositionInfoResponse
68-
x-additionalPropertiesName: composition-id
69-
type: object
70-
properties:
71-
injectedItems:
72-
type: array
73-
items:
74-
$ref: '#/resultsInjectedItemInfoResponse'
75-
required:
76-
- injectedItems
118+
$ref: '#/resultsCompositionInfoResponse'
77119
required:
78120
- compositions
79121

122+
resultsCompositionInfoResponse:
123+
type: object
124+
x-additionalPropertiesName: composition-id
125+
properties:
126+
injectedItems:
127+
type: array
128+
items:
129+
$ref: '#/resultsInjectedItemInfoResponse'
130+
required:
131+
- injectedItems
132+
80133
resultsInjectedItemInfoResponse:
81134
type: object
82135
additionalProperties: true
83136
properties:
84137
key:
85138
type: string
139+
description: The key of the injected group.
140+
example: 'men-sponsored-group'
86141
appliedRules:
87142
type: array
88143
items:
89-
title: resultsInjectedItemAppliedRulesInfoResponse
90-
type: object
91-
properties:
92-
objectID:
93-
$ref: '../../../../../common/parameters.yml#/objectID'
94-
required:
95-
- objectID
144+
$ref: '#/resultsInjectedItemAppliedRulesInfoResponse'
145+
required:
146+
- key
147+
148+
resultsInjectedItemAppliedRulesInfoResponse:
149+
type: object
150+
properties:
151+
objectID:
152+
type: string
153+
description: The objectID of the applied index level rule on this injected group.
154+
example:
155+
objectID: 'qr-1765458959657'
96156
required:
97-
- key
157+
- objectID

0 commit comments

Comments
 (0)