Skip to content

Commit bcadf3a

Browse files
algolia-botmillotp
andcommitted
fix(specs): typoTolerance can be a boolean string (#4900) (generated) [skip ci]
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
1 parent d5c46bf commit bcadf3a

File tree

128 files changed

+673
-483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+673
-483
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/Distinct.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ public partial class Distinct : AbstractSchema
2222
{
2323
/// <summary>
2424
/// Initializes a new instance of the Distinct class
25-
/// with a bool
25+
/// with a int
2626
/// </summary>
27-
/// <param name="actualInstance">An instance of bool.</param>
28-
public Distinct(bool actualInstance)
27+
/// <param name="actualInstance">An instance of int.</param>
28+
public Distinct(int actualInstance)
2929
{
3030
ActualInstance = actualInstance;
3131
}
3232

3333
/// <summary>
3434
/// Initializes a new instance of the Distinct class
35-
/// with a int
35+
/// with a bool
3636
/// </summary>
37-
/// <param name="actualInstance">An instance of int.</param>
38-
public Distinct(int actualInstance)
37+
/// <param name="actualInstance">An instance of bool.</param>
38+
public Distinct(bool actualInstance)
3939
{
4040
ActualInstance = actualInstance;
4141
}
@@ -45,16 +45,6 @@ public Distinct(int actualInstance)
4545
/// </summary>
4646
public sealed override object ActualInstance { get; set; }
4747

48-
/// <summary>
49-
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
50-
/// the InvalidClassException will be thrown
51-
/// </summary>
52-
/// <returns>An instance of bool</returns>
53-
public bool AsBool()
54-
{
55-
return (bool)ActualInstance;
56-
}
57-
5848
/// <summary>
5949
/// Get the actual instance of `int`. If the actual instance is not `int`,
6050
/// the InvalidClassException will be thrown
@@ -66,12 +56,13 @@ public int AsInt()
6656
}
6757

6858
/// <summary>
69-
/// Check if the actual instance is of `bool` type.
59+
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
60+
/// the InvalidClassException will be thrown
7061
/// </summary>
71-
/// <returns>Whether or not the instance is the type</returns>
72-
public bool IsBool()
62+
/// <returns>An instance of bool</returns>
63+
public bool AsBool()
7364
{
74-
return ActualInstance.GetType() == typeof(bool);
65+
return (bool)ActualInstance;
7566
}
7667

7768
/// <summary>
@@ -83,6 +74,15 @@ public bool IsInt()
8374
return ActualInstance.GetType() == typeof(int);
8475
}
8576

77+
/// <summary>
78+
/// Check if the actual instance is of `bool` type.
79+
/// </summary>
80+
/// <returns>Whether or not the instance is the type</returns>
81+
public bool IsBool()
82+
{
83+
return ActualInstance.GetType() == typeof(bool);
84+
}
85+
8686
/// <summary>
8787
/// Returns the string presentation of the object
8888
/// </summary>
@@ -166,28 +166,28 @@ JsonSerializerOptions options
166166
{
167167
var jsonDocument = JsonDocument.ParseValue(ref reader);
168168
var root = jsonDocument.RootElement;
169-
if (root.ValueKind == JsonValueKind.True || root.ValueKind == JsonValueKind.False)
169+
if (root.ValueKind == JsonValueKind.Number)
170170
{
171171
try
172172
{
173-
return new Distinct(jsonDocument.Deserialize<bool>(JsonConfig.Options));
173+
return new Distinct(jsonDocument.Deserialize<int>(JsonConfig.Options));
174174
}
175175
catch (Exception exception)
176176
{
177177
// deserialization failed, try the next one
178-
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into bool: {exception}");
178+
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into int: {exception}");
179179
}
180180
}
181-
if (root.ValueKind == JsonValueKind.Number)
181+
if (root.ValueKind == JsonValueKind.True || root.ValueKind == JsonValueKind.False)
182182
{
183183
try
184184
{
185-
return new Distinct(jsonDocument.Deserialize<int>(JsonConfig.Options));
185+
return new Distinct(jsonDocument.Deserialize<bool>(JsonConfig.Options));
186186
}
187187
catch (Exception exception)
188188
{
189189
// deserialization failed, try the next one
190-
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into int: {exception}");
190+
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into bool: {exception}");
191191
}
192192
}
193193
throw new InvalidDataException(

clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/TypoTolerance.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ public partial class TypoTolerance : AbstractSchema
2222
{
2323
/// <summary>
2424
/// Initializes a new instance of the TypoTolerance class
25-
/// with a bool
25+
/// with a TypoToleranceEnum
2626
/// </summary>
27-
/// <param name="actualInstance">An instance of bool.</param>
28-
public TypoTolerance(bool actualInstance)
27+
/// <param name="actualInstance">An instance of TypoToleranceEnum.</param>
28+
public TypoTolerance(TypoToleranceEnum actualInstance)
2929
{
3030
ActualInstance = actualInstance;
3131
}
3232

3333
/// <summary>
3434
/// Initializes a new instance of the TypoTolerance class
35-
/// with a TypoToleranceEnum
35+
/// with a bool
3636
/// </summary>
37-
/// <param name="actualInstance">An instance of TypoToleranceEnum.</param>
38-
public TypoTolerance(TypoToleranceEnum actualInstance)
37+
/// <param name="actualInstance">An instance of bool.</param>
38+
public TypoTolerance(bool actualInstance)
3939
{
4040
ActualInstance = actualInstance;
4141
}
@@ -45,16 +45,6 @@ public TypoTolerance(TypoToleranceEnum actualInstance)
4545
/// </summary>
4646
public sealed override object ActualInstance { get; set; }
4747

48-
/// <summary>
49-
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
50-
/// the InvalidClassException will be thrown
51-
/// </summary>
52-
/// <returns>An instance of bool</returns>
53-
public bool AsBool()
54-
{
55-
return (bool)ActualInstance;
56-
}
57-
5848
/// <summary>
5949
/// Get the actual instance of `TypoToleranceEnum`. If the actual instance is not `TypoToleranceEnum`,
6050
/// the InvalidClassException will be thrown
@@ -66,12 +56,13 @@ public TypoToleranceEnum AsTypoToleranceEnum()
6656
}
6757

6858
/// <summary>
69-
/// Check if the actual instance is of `bool` type.
59+
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
60+
/// the InvalidClassException will be thrown
7061
/// </summary>
71-
/// <returns>Whether or not the instance is the type</returns>
72-
public bool IsBool()
62+
/// <returns>An instance of bool</returns>
63+
public bool AsBool()
7364
{
74-
return ActualInstance.GetType() == typeof(bool);
65+
return (bool)ActualInstance;
7566
}
7667

7768
/// <summary>
@@ -83,6 +74,15 @@ public bool IsTypoToleranceEnum()
8374
return ActualInstance.GetType() == typeof(TypoToleranceEnum);
8475
}
8576

77+
/// <summary>
78+
/// Check if the actual instance is of `bool` type.
79+
/// </summary>
80+
/// <returns>Whether or not the instance is the type</returns>
81+
public bool IsBool()
82+
{
83+
return ActualInstance.GetType() == typeof(bool);
84+
}
85+
8686
/// <summary>
8787
/// Returns the string presentation of the object
8888
/// </summary>
@@ -166,30 +166,30 @@ JsonSerializerOptions options
166166
{
167167
var jsonDocument = JsonDocument.ParseValue(ref reader);
168168
var root = jsonDocument.RootElement;
169-
if (root.ValueKind == JsonValueKind.True || root.ValueKind == JsonValueKind.False)
169+
if (root.ValueKind == JsonValueKind.String)
170170
{
171171
try
172172
{
173-
return new TypoTolerance(jsonDocument.Deserialize<bool>(JsonConfig.Options));
173+
return new TypoTolerance(jsonDocument.Deserialize<TypoToleranceEnum>(JsonConfig.Options));
174174
}
175175
catch (Exception exception)
176176
{
177177
// deserialization failed, try the next one
178-
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into bool: {exception}");
178+
System.Diagnostics.Debug.WriteLine(
179+
$"Failed to deserialize into TypoToleranceEnum: {exception}"
180+
);
179181
}
180182
}
181-
if (root.ValueKind == JsonValueKind.String)
183+
if (root.ValueKind == JsonValueKind.True || root.ValueKind == JsonValueKind.False)
182184
{
183185
try
184186
{
185-
return new TypoTolerance(jsonDocument.Deserialize<TypoToleranceEnum>(JsonConfig.Options));
187+
return new TypoTolerance(jsonDocument.Deserialize<bool>(JsonConfig.Options));
186188
}
187189
catch (Exception exception)
188190
{
189191
// deserialization failed, try the next one
190-
System.Diagnostics.Debug.WriteLine(
191-
$"Failed to deserialize into TypoToleranceEnum: {exception}"
192-
);
192+
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into bool: {exception}");
193193
}
194194
}
195195
throw new InvalidDataException(

clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/TypoToleranceEnum.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,16 @@ public enum TypoToleranceEnum
2929
/// </summary>
3030
[JsonPropertyName("strict")]
3131
Strict = 2,
32+
33+
/// <summary>
34+
/// Enum True for value: true
35+
/// </summary>
36+
[JsonPropertyName("true")]
37+
True = 3,
38+
39+
/// <summary>
40+
/// Enum False for value: false
41+
/// </summary>
42+
[JsonPropertyName("false")]
43+
False = 4,
3244
}

clients/algoliasearch-client-csharp/algoliasearch/Models/Search/Distinct.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ public partial class Distinct : AbstractSchema
2222
{
2323
/// <summary>
2424
/// Initializes a new instance of the Distinct class
25-
/// with a bool
25+
/// with a int
2626
/// </summary>
27-
/// <param name="actualInstance">An instance of bool.</param>
28-
public Distinct(bool actualInstance)
27+
/// <param name="actualInstance">An instance of int.</param>
28+
public Distinct(int actualInstance)
2929
{
3030
ActualInstance = actualInstance;
3131
}
3232

3333
/// <summary>
3434
/// Initializes a new instance of the Distinct class
35-
/// with a int
35+
/// with a bool
3636
/// </summary>
37-
/// <param name="actualInstance">An instance of int.</param>
38-
public Distinct(int actualInstance)
37+
/// <param name="actualInstance">An instance of bool.</param>
38+
public Distinct(bool actualInstance)
3939
{
4040
ActualInstance = actualInstance;
4141
}
@@ -45,16 +45,6 @@ public Distinct(int actualInstance)
4545
/// </summary>
4646
public sealed override object ActualInstance { get; set; }
4747

48-
/// <summary>
49-
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
50-
/// the InvalidClassException will be thrown
51-
/// </summary>
52-
/// <returns>An instance of bool</returns>
53-
public bool AsBool()
54-
{
55-
return (bool)ActualInstance;
56-
}
57-
5848
/// <summary>
5949
/// Get the actual instance of `int`. If the actual instance is not `int`,
6050
/// the InvalidClassException will be thrown
@@ -66,12 +56,13 @@ public int AsInt()
6656
}
6757

6858
/// <summary>
69-
/// Check if the actual instance is of `bool` type.
59+
/// Get the actual instance of `bool`. If the actual instance is not `bool`,
60+
/// the InvalidClassException will be thrown
7061
/// </summary>
71-
/// <returns>Whether or not the instance is the type</returns>
72-
public bool IsBool()
62+
/// <returns>An instance of bool</returns>
63+
public bool AsBool()
7364
{
74-
return ActualInstance.GetType() == typeof(bool);
65+
return (bool)ActualInstance;
7566
}
7667

7768
/// <summary>
@@ -83,6 +74,15 @@ public bool IsInt()
8374
return ActualInstance.GetType() == typeof(int);
8475
}
8576

77+
/// <summary>
78+
/// Check if the actual instance is of `bool` type.
79+
/// </summary>
80+
/// <returns>Whether or not the instance is the type</returns>
81+
public bool IsBool()
82+
{
83+
return ActualInstance.GetType() == typeof(bool);
84+
}
85+
8686
/// <summary>
8787
/// Returns the string presentation of the object
8888
/// </summary>
@@ -166,28 +166,28 @@ JsonSerializerOptions options
166166
{
167167
var jsonDocument = JsonDocument.ParseValue(ref reader);
168168
var root = jsonDocument.RootElement;
169-
if (root.ValueKind == JsonValueKind.True || root.ValueKind == JsonValueKind.False)
169+
if (root.ValueKind == JsonValueKind.Number)
170170
{
171171
try
172172
{
173-
return new Distinct(jsonDocument.Deserialize<bool>(JsonConfig.Options));
173+
return new Distinct(jsonDocument.Deserialize<int>(JsonConfig.Options));
174174
}
175175
catch (Exception exception)
176176
{
177177
// deserialization failed, try the next one
178-
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into bool: {exception}");
178+
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into int: {exception}");
179179
}
180180
}
181-
if (root.ValueKind == JsonValueKind.Number)
181+
if (root.ValueKind == JsonValueKind.True || root.ValueKind == JsonValueKind.False)
182182
{
183183
try
184184
{
185-
return new Distinct(jsonDocument.Deserialize<int>(JsonConfig.Options));
185+
return new Distinct(jsonDocument.Deserialize<bool>(JsonConfig.Options));
186186
}
187187
catch (Exception exception)
188188
{
189189
// deserialization failed, try the next one
190-
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into int: {exception}");
190+
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into bool: {exception}");
191191
}
192192
}
193193
throw new InvalidDataException(

0 commit comments

Comments
 (0)