diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/AbstractSchema.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/AbstractSchema.cs
deleted file mode 100644
index 586c2944e1..0000000000
--- a/clients/algoliasearch-client-csharp/algoliasearch/Models/AbstractSchema.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
-//
-
-using System;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
-
-namespace Algolia.Search.Models
-{
- ///
- /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification
- ///
- public abstract partial class AbstractSchema
- {
- ///
- /// Custom JSON serializer
- ///
- static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings
- {
- // OpenAPI generated types generally hide default constructors.
- ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
- MissingMemberHandling = MissingMemberHandling.Error,
- ContractResolver = new DefaultContractResolver
- {
- NamingStrategy = new CamelCaseNamingStrategy
- {
- OverrideSpecifiedNames = false
- }
- }
- };
-
- ///
- /// Custom JSON serializer for objects with additional properties
- ///
- static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings
- {
- // OpenAPI generated types generally hide default constructors.
- ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
- MissingMemberHandling = MissingMemberHandling.Ignore,
- ContractResolver = new DefaultContractResolver
- {
- NamingStrategy = new CamelCaseNamingStrategy
- {
- OverrideSpecifiedNames = false
- }
- }
- };
-
- ///
- /// Gets or Sets the actual instance
- ///
- public abstract Object ActualInstance { get; set; }
-
- ///
- /// Gets or Sets IsNullable to indicate whether the instance is nullable
- ///
- public bool IsNullable { get; protected set; }
-
- ///
- /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf`
- ///
- public string SchemaType { get; protected set; }
-
- ///
- /// Converts the instance into JSON string.
- ///
- public abstract string ToJson();
- }
-}
diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Common/AbstractSchema.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Common/AbstractSchema.cs
index c333ee9101..f6f4d33d3c 100644
--- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Common/AbstractSchema.cs
+++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Common/AbstractSchema.cs
@@ -1,65 +1,30 @@
using System;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
-namespace Algolia.Search.Models.Common;
-
-///
-/// Abstract base class for oneOf, anyOf schemas in the API specification
-///
-public abstract class AbstractSchema
+namespace Algolia.Search.Models.Common
{
///
- /// Custom JSON serializer
+ /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification
///
- public static readonly JsonSerializerSettings SerializerSettings = new()
+ public abstract partial class AbstractSchema
{
- // OpenAPI generated types generally hide default constructors.
- ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
- MissingMemberHandling = MissingMemberHandling.Error,
- ContractResolver = new DefaultContractResolver
- {
- NamingStrategy = new CamelCaseNamingStrategy
- {
- OverrideSpecifiedNames = false
- }
- }
- };
-
- ///
- /// Custom JSON serializer for objects with additional properties
- ///
- public static readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings
- {
- // OpenAPI generated types generally hide default constructors.
- ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
- MissingMemberHandling = MissingMemberHandling.Ignore,
- ContractResolver = new DefaultContractResolver
- {
- NamingStrategy = new CamelCaseNamingStrategy
- {
- OverrideSpecifiedNames = false
- }
- }
- };
-
- ///
- /// Gets or Sets the actual instance
- ///
- public abstract object ActualInstance { get; set; }
+ ///
+ /// Gets or Sets the actual instance
+ ///
+ public abstract Object ActualInstance { get; set; }
- ///
- /// Gets or Sets IsNullable to indicate whether the instance is nullable
- ///
- public bool IsNullable { get; protected set; }
+ ///
+ /// Gets or Sets IsNullable to indicate whether the instance is nullable
+ ///
+ public bool IsNullable { get; protected set; }
- ///
- /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf`
- ///
- public string SchemaType { get; protected set; }
+ ///
+ /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf`
+ ///
+ public string SchemaType { get; protected set; }
- ///
- /// Converts the instance into JSON string.
- ///
- public abstract string ToJson();
+ ///
+ /// Converts the instance into JSON string.
+ ///
+ public abstract string ToJson();
+ }
}
diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Serializer/DefaultSerializer.cs b/clients/algoliasearch-client-csharp/algoliasearch/Serializer/DefaultSerializer.cs
index 3fd471a107..b48ab8ca0b 100644
--- a/clients/algoliasearch-client-csharp/algoliasearch/Serializer/DefaultSerializer.cs
+++ b/clients/algoliasearch-client-csharp/algoliasearch/Serializer/DefaultSerializer.cs
@@ -1,6 +1,5 @@
using System;
using System.IO;
-using System.Text;
using System.Threading.Tasks;
using Algolia.Search.Exceptions;
using Algolia.Search.Models.Common;
@@ -11,29 +10,28 @@ namespace Algolia.Search.Serializer;
internal class DefaultJsonSerializer : ISerializer
{
- private readonly JsonSerializerSettings _serializerSettings;
private readonly ILogger _logger;
- public DefaultJsonSerializer(JsonSerializerSettings serializerSettings, ILoggerFactory logger)
+ public DefaultJsonSerializer(ILoggerFactory logger)
{
- _serializerSettings = serializerSettings;
_logger = logger.CreateLogger();
}
///
/// Serialize the object into a JSON string.
///
- /// Object to be serialized.
+ /// Object to be serialized.
/// A JSON string.
- public string Serialize(object obj)
+ public string Serialize(object data)
{
- if (obj is AbstractSchema schema)
+ if (data is AbstractSchema schema)
{
// the object to be serialized is an oneOf/anyOf schema
- return schema.ToJson();
+ var serialize = schema.ToJson();
+ return serialize;
}
- return JsonConvert.SerializeObject(obj, _serializerSettings);
+ return JsonConvert.SerializeObject(data, JsonConfig.AlgoliaJsonSerializerSettings);
}
public async Task Deserialize(Stream response)
@@ -50,37 +48,12 @@ public async Task Deserialize(Stream response)
/// Object representation of the JSON string.
private async Task