Skip to content

Commit

Permalink
fix(specs): remove some parameters from trending requests (#1915)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Aug 17, 2023
1 parent 29e72a9 commit 693631c
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/.cache_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.91
0.0.93
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ void main() async {

// Creating recommendation requests for different products.
var requests = [
RecommendationRequest(
RecommendationsQuery(
model: RecommendationModels.relatedProducts,
objectID: '6445156',
indexName: 'instant_search',
threshold: 70,
maxRecommendations: 3,
),
RecommendationRequest(
RecommendationsQuery(
model: RecommendationModels.relatedProducts,
objectID: '6443034',
indexName: 'instant_search',
Expand Down
14 changes: 7 additions & 7 deletions clients/algoliasearch-client-javascript/bundlesize.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"files": [
{
"path": "packages/algoliasearch/dist/algoliasearch.umd.js",
"maxSize": "8.05KB"
"maxSize": "8.55KB"
},
{
"path": "packages/algoliasearch/dist/lite/lite.umd.js",
"maxSize": "3.75KB"
"maxSize": "3.70KB"
},
{
"path": "packages/client-abtesting/dist/client-abtesting.umd.js",
Expand All @@ -18,31 +18,31 @@
},
{
"path": "packages/client-insights/dist/client-insights.umd.js",
"maxSize": "3.70KB"
"maxSize": "3.65KB"
},
{
"path": "packages/client-personalization/dist/client-personalization.umd.js",
"maxSize": "3.85KB"
"maxSize": "3.80KB"
},
{
"path": "packages/client-query-suggestions/dist/client-query-suggestions.umd.js",
"maxSize": "3.90KB"
"maxSize": "3.85KB"
},
{
"path": "packages/client-search/dist/client-search.umd.js",
"maxSize": "6.60KB"
},
{
"path": "packages/ingestion/dist/ingestion.umd.js",
"maxSize": "5.00KB"
"maxSize": "4.95KB"
},
{
"path": "packages/monitoring/dist/monitoring.umd.js",
"maxSize": "3.90KB"
},
{
"path": "packages/recommend/dist/recommend.umd.js",
"maxSize": "3.70KB"
"maxSize": "3.95KB"
}
]
}
23 changes: 23 additions & 0 deletions specs/recommend/common/schemas/RecommendationsQuery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
recommendationsQuery:
allOf:
- type: object
title: baseRecommendationsQuery
additionalProperties: false
properties:
model:
$ref: '#/recommendationModels'
objectID:
$ref: '../../../common/parameters.yml#/objectID'
queryParameters:
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
fallbackParameters:
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
required:
- model
- objectID
- $ref: './RecommendationsRequest.yml#/baseRecommendRequest'

recommendationModels:
description: Recommendation model.
type: string
enum: [related-products, bought-together]
53 changes: 3 additions & 50 deletions specs/recommend/common/schemas/RecommendationsRequest.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,8 @@
recommendationsRequest:
oneOf:
- $ref: '#/trendingRequest'
- $ref: '#/recommendationRequest'

trendingRequest:
allOf:
- type: object
title: baseTrendingRequest
additionalProperties: false
properties:
model:
$ref: '#/trendingModels'
facetName:
type: string
description: Facet name for trending models.
facetValue:
type: string
description: Facet value for trending models.
required:
- model
- $ref: '#/baseRecommendRequest'

recommendationRequest:
allOf:
- type: object
title: baseRecommendationRequest
additionalProperties: false
properties:
model:
$ref: '#/recommendationModels'
objectID:
$ref: '../../../common/parameters.yml#/objectID'
required:
- model
- objectID
- $ref: '#/baseRecommendRequest'
- $ref: './TrendingQuery.yml#/trendingItemsQuery'
- $ref: './TrendingQuery.yml#/trendingFacetsQuery'
- $ref: './RecommendationsQuery.yml#/recommendationsQuery'

baseRecommendRequest:
type: object
Expand All @@ -54,20 +22,5 @@ baseRecommendRequest:
type: integer
default: 0
description: Maximum number of recommendations to retrieve. If 0, all recommendations will be returned.
queryParameters:
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
fallbackParameters:
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
required:
- indexName
- threshold

trendingModels:
description: Trending model.
type: string
enum: [trending-facets, trending-items]

recommendationModels:
description: Recommendation model.
type: string
enum: [related-products, bought-together]
46 changes: 46 additions & 0 deletions specs/recommend/common/schemas/TrendingQuery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
trendingItemsQuery:
allOf:
- type: object
title: baseTrendingItemsQuery
additionalProperties: false
properties:
facetName:
$ref: '#/facetName'
facetValue:
type: string
description: Facet value for trending models.
model:
$ref: '#/trendingItemsModel'
queryParameters:
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
fallbackParameters:
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
- $ref: './RecommendationsRequest.yml#/baseRecommendRequest'

trendingFacetsQuery:
allOf:
- type: object
title: baseTrendingFacetsQuery
additionalProperties: false
properties:
facetName:
$ref: '#/facetName'
model:
$ref: '#/trendingFacetsModel'
required:
- facetName
- $ref: './RecommendationsRequest.yml#/baseRecommendRequest'

trendingFacetsModel:
description: Trending facets model.
type: string
enum: [trending-facets]

trendingItemsModel:
description: Trending items model.
type: string
enum: [trending-items]

facetName:
type: string
description: Facet name for trending models.
10 changes: 5 additions & 5 deletions tests/output/javascript/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,10 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:18.17.3":
version: 18.17.3
resolution: "@types/node@npm:18.17.3"
checksum: 884fb68936b2b0ff90863fcf80610dd2f3d9fe1947897248b0138df05fe41ee6ce62941b37b565e3b3fd77601cd3977a64de858654c6ab9064413b171740d6ba
"@types/node@npm:18.17.5":
version: 18.17.5
resolution: "@types/node@npm:18.17.5"
checksum: b8c658a99234b99425243c324b641ed7b9ceb6bee6b06421fdc9bb7c58f9a5552e353225cc549e6982462ac384abe1985022ed76e2e4728797f59b21f659ca2b
languageName: node
linkType: hard

Expand Down Expand Up @@ -2239,7 +2239,7 @@ __metadata:
"@algolia/recommend": "link:../../../clients/algoliasearch-client-javascript/packages/recommend"
"@algolia/requester-node-http": "link:../../../clients/algoliasearch-client-javascript/packages/requester-node-http"
"@types/jest": 29.5.3
"@types/node": 18.17.3
"@types/node": 18.17.5
algoliasearch: "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch"
jest: 29.6.2
ts-jest: 29.1.1
Expand Down

0 comments on commit 693631c

Please sign in to comment.