Skip to content

Commit 5100204

Browse files
authored
fix(javascript): allow undefined object when all parameters are optional (#922)
1 parent e4261d3 commit 5100204

File tree

7 files changed

+48
-4
lines changed

7 files changed

+48
-4
lines changed

clients/algoliasearch-client-javascript/bundlesize.config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"files": [
33
{
44
"path": "packages/algoliasearch/dist/algoliasearch.umd.js",
5-
"maxSize": "7.75KB"
5+
"maxSize": "7.80KB"
66
},
77
{
88
"path": "packages/algoliasearch/dist/lite/lite.umd.js",
@@ -26,7 +26,7 @@
2626
},
2727
{
2828
"path": "packages/client-query-suggestions/dist/client-query-suggestions.umd.js",
29-
"maxSize": "3.65KB"
29+
"maxSize": "3.70KB"
3030
},
3131
{
3232
"path": "packages/client-search/dist/client-search.umd.js",

templates/javascript/clients/client/api/operation/parameters.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
{{#allParams}}
55
{{paramName}},
66
{{/allParams}}
7-
}: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props,
7+
}: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props{{^hasRequiredParams}} = {}{{/hasRequiredParams}},
88
{{/x-create-wrapping-object}}
99
{{#x-is-single-body-param}}
1010
{{#bodyParams}}
1111
{{paramName}}: {{{dataType}}} {{#x-legacy-signature}} | LegacySearchMethodProps{{/x-legacy-signature}},
1212
{{/bodyParams}}
1313
{{/x-is-single-body-param}}
1414
{{/vendorExtensions}}
15-
requestOptions?: RequestOptions
15+
requestOptions{{^hasParams}}?{{/hasParams}}{{#hasParams}}{{#hasRequiredParams}}?{{/hasRequiredParams}}{{/hasParams}}: RequestOptions{{#hasParams}}{{^hasRequiredParams}} | undefined = undefined{{/hasRequiredParams}}{{/hasParams}}

tests/CTS/methods/requests/abtesting/listABTests.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
[
22
{
33
"testName": "listABTests with minimal parameters",
4+
"parameters": {},
5+
"request": {
6+
"path": "/2/abtests",
7+
"method": "GET"
8+
}
9+
},
10+
{
11+
"testName": "listABTests with parameters",
412
"parameters": {
513
"offset": 42,
614
"limit": 21

tests/CTS/methods/requests/search/getLogs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
[
22
{
3+
"testName": "getLogs with minimal parameters",
4+
"parameters": {},
5+
"request": {
6+
"path": "/1/logs",
7+
"method": "GET"
8+
}
9+
},
10+
{
11+
"testName": "getLogs with parameters",
312
"parameters": {
413
"offset": 5,
514
"length": 10,

tests/CTS/methods/requests/search/hasPendingMappings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
[
22
{
3+
"testName": "hasPendingMappings with minimal parameters",
4+
"parameters": {},
5+
"request": {
6+
"path": "/1/clusters/mapping/pending",
7+
"method": "GET"
8+
}
9+
},
10+
{
11+
"testName": "hasPendingMappings with parameters",
312
"parameters": {
413
"getClusters": true
514
},

tests/CTS/methods/requests/search/listIndices.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
[
22
{
3+
"testName": "listIndices with minimal parameters",
4+
"parameters": {},
5+
"request": {
6+
"path": "/1/indexes",
7+
"method": "GET"
8+
}
9+
},
10+
{
11+
"testName": "listIndices with parameters",
312
"parameters": {
413
"page": 8
514
},

tests/CTS/methods/requests/search/listUserIds.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
[
22
{
3+
"testName": "listUserIds with minimal parameters",
4+
"parameters": {},
5+
"request": {
6+
"path": "/1/clusters/mapping",
7+
"method": "GET"
8+
}
9+
},
10+
{
11+
"testName": "listUserIds with parameters",
312
"parameters": {
413
"page": 8,
514
"hitsPerPage": 100

0 commit comments

Comments
 (0)