Skip to content

Commit 08e9d18

Browse files
authored
fix(specs): add getVersion parameter to getSettings (#5254)
1 parent 3703081 commit 08e9d18

File tree

6 files changed

+37
-24
lines changed

6 files changed

+37
-24
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Serializer/EnumConverter.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,21 @@ JsonSerializerOptions options
9191
switch (type)
9292
{
9393
case JsonTokenType.String:
94+
{
95+
var stringValue = reader.GetString();
96+
if (stringValue != null && _stringToEnum.TryGetValue(stringValue, out var enumValue))
9497
{
95-
var stringValue = reader.GetString();
96-
if (stringValue != null && _stringToEnum.TryGetValue(stringValue, out var enumValue))
97-
{
98-
return enumValue;
99-
}
100-
101-
break;
102-
}
103-
case JsonTokenType.Number:
104-
{
105-
var numValue = reader.GetInt32();
106-
_numberToEnum.TryGetValue(numValue, out var enumValue);
10798
return enumValue;
10899
}
100+
101+
break;
102+
}
103+
case JsonTokenType.Number:
104+
{
105+
var numValue = reader.GetInt32();
106+
_numberToEnum.TryGetValue(numValue, out var enumValue);
107+
return enumValue;
108+
}
109109
}
110110

111111
return default;

clients/algoliasearch-client-csharp/algoliasearch/Utils/QueryStringHelper.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ public static string ParameterToString(object obj)
3636
case bool boolean:
3737
return boolean ? "true" : "false";
3838
case ICollection collection:
39-
{
40-
var entries = new List<string>();
41-
foreach (var entry in collection)
42-
entries.Add(ParameterToString(entry));
43-
return string.Join(",", entries);
44-
}
39+
{
40+
var entries = new List<string>();
41+
foreach (var entry in collection)
42+
entries.Add(ParameterToString(entry));
43+
return string.Join(",", entries);
44+
}
4545
case Enum when HasEnumMemberAttrValue(obj):
4646
return GetEnumMemberAttrValue(obj);
4747
case AbstractSchema schema when obj.GetType().IsClass:
48-
{
49-
return ParameterToString(schema.ActualInstance);
50-
}
48+
{
49+
return ParameterToString(schema.ActualInstance);
50+
}
5151
default:
5252
return Convert.ToString(obj, CultureInfo.InvariantCulture);
5353
}

clients/algoliasearch-client-csharp/algoliasearch/Utils/SearchClientExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ public async Task<bool> IndexExistsAsync(
11571157
{
11581158
try
11591159
{
1160-
await GetSettingsAsync(indexName, null, cancellationToken);
1160+
await GetSettingsAsync(indexName, null, null, cancellationToken);
11611161
}
11621162
catch (AlgoliaApiException ex) when (ex.HttpErrorCode == 404)
11631163
{

specs/search/common/parameters.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,11 @@ userID:
3232
pattern: '^[a-zA-Z0-9 \-*.]+$'
3333
description: Unique identifier of the user who makes the search request.
3434
example: user1
35+
36+
getVersion:
37+
name: getVersion
38+
description: When set to 2, the endpoint will not include `synonyms` in the response. This parameter is here for backward compatibility.
39+
in: query
40+
schema:
41+
type: integer
42+
default: 1

specs/search/paths/settings/settings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ get:
99
summary: Retrieve index settings
1010
parameters:
1111
- $ref: '../../../common/parameters.yml#/IndexName'
12+
- $ref: '../../common/parameters.yml#/getVersion'
1213
responses:
1314
'200':
1415
description: OK

tests/CTS/requests/search/getSettings.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
[
22
{
33
"parameters": {
4-
"indexName": "cts_e2e_settings"
4+
"indexName": "cts_e2e_settings",
5+
"getVersion": 2
56
},
67
"request": {
78
"path": "/1/indexes/cts_e2e_settings/settings",
8-
"method": "GET"
9+
"method": "GET",
10+
"queryParameters": {
11+
"getVersion": "2"
12+
}
913
},
1014
"response": {
1115
"statusCode": 200,

0 commit comments

Comments
 (0)