mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
update samples
This commit is contained in:
@@ -165,6 +165,23 @@ namespace Org.OpenAPITools.Client
|
||||
{
|
||||
private readonly String _baseUrl;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
|
||||
/// These settings can be adjusted to accomodate custom serialization rules.
|
||||
/// </summary>
|
||||
public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings
|
||||
{
|
||||
// OpenAPI generated types generally hide default constructors.
|
||||
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
NamingStrategy = new CamelCaseNamingStrategy
|
||||
{
|
||||
OverrideSpecifiedNames = false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Allows for extending request processing for <see cref="ApiClient"/> generated code.
|
||||
/// </summary>
|
||||
@@ -263,7 +280,7 @@ namespace Org.OpenAPITools.Client
|
||||
RestRequest request = new RestRequest(Method(method))
|
||||
{
|
||||
Resource = path,
|
||||
JsonSerializer = new CustomJsonCodec(configuration)
|
||||
JsonSerializer = new CustomJsonCodec(SerializerSettings, configuration)
|
||||
};
|
||||
|
||||
if (options.PathParameters != null)
|
||||
@@ -411,7 +428,7 @@ namespace Org.OpenAPITools.Client
|
||||
}
|
||||
else
|
||||
{
|
||||
var customDeserializer = new CustomJsonCodec(configuration);
|
||||
var customDeserializer = new CustomJsonCodec(SerializerSettings, configuration);
|
||||
client.AddHandler("application/json", () => customDeserializer);
|
||||
client.AddHandler("text/json", () => customDeserializer);
|
||||
client.AddHandler("text/x-json", () => customDeserializer);
|
||||
@@ -513,7 +530,7 @@ namespace Org.OpenAPITools.Client
|
||||
}
|
||||
else
|
||||
{
|
||||
var customDeserializer = new CustomJsonCodec(configuration);
|
||||
var customDeserializer = new CustomJsonCodec(SerializerSettings, configuration);
|
||||
client.AddHandler("application/json", () => customDeserializer);
|
||||
client.AddHandler("text/json", () => customDeserializer);
|
||||
client.AddHandler("text/x-json", () => customDeserializer);
|
||||
|
||||
Reference in New Issue
Block a user