Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ JsonSerializerOptions options
switch (type)
{
case JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null && _stringToEnum.TryGetValue(stringValue, out var enumValue))
{
var stringValue = reader.GetString();
if (stringValue != null && _stringToEnum.TryGetValue(stringValue, out var enumValue))
{
return enumValue;
}

break;
}
case JsonTokenType.Number:
{
var numValue = reader.GetInt32();
_numberToEnum.TryGetValue(numValue, out var enumValue);
return enumValue;
}

break;
}
case JsonTokenType.Number:
{
var numValue = reader.GetInt32();
_numberToEnum.TryGetValue(numValue, out var enumValue);
return enumValue;
}
}

return default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ public static string ParameterToString(object obj)
case bool boolean:
return boolean ? "true" : "false";
case ICollection collection:
{
var entries = new List<string>();
foreach (var entry in collection)
entries.Add(ParameterToString(entry));
return string.Join(",", entries);
}
{
var entries = new List<string>();
foreach (var entry in collection)
entries.Add(ParameterToString(entry));
return string.Join(",", entries);
}
case Enum when HasEnumMemberAttrValue(obj):
return GetEnumMemberAttrValue(obj);
case AbstractSchema schema when obj.GetType().IsClass:
{
return ParameterToString(schema.ActualInstance);
}
{
return ParameterToString(schema.ActualInstance);
}
default:
return Convert.ToString(obj, CultureInfo.InvariantCulture);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ public async Task<bool> IndexExistsAsync(
{
try
{
await GetSettingsAsync(indexName, null, cancellationToken);
await GetSettingsAsync(indexName, null, null, cancellationToken);
}
catch (AlgoliaApiException ex) when (ex.HttpErrorCode == 404)
{
Expand Down
8 changes: 8 additions & 0 deletions specs/search/common/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ userID:
pattern: '^[a-zA-Z0-9 \-*.]+$'
description: Unique identifier of the user who makes the search request.
example: user1

getVersion:
name: getVersion
description: When set to 2, the endpoint will not include `synonyms` in the response. This parameter is here for backward compatibility.
in: query
schema:
type: integer
default: 1
1 change: 1 addition & 0 deletions specs/search/paths/settings/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ get:
summary: Retrieve index settings
parameters:
- $ref: '../../../common/parameters.yml#/IndexName'
- $ref: '../../common/parameters.yml#/getVersion'
responses:
'200':
description: OK
Expand Down
8 changes: 6 additions & 2 deletions tests/CTS/requests/search/getSettings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
[
{
"parameters": {
"indexName": "cts_e2e_settings"
"indexName": "cts_e2e_settings",
"getVersion": 2
},
"request": {
"path": "/1/indexes/cts_e2e_settings/settings",
"method": "GET"
"method": "GET",
"queryParameters": {
"getVersion": "2"
}
},
"response": {
"statusCode": 200,
Expand Down