moved deserialization to template (#15474)

This commit is contained in:
devhl-labs
2023-05-11 04:44:37 -04:00
committed by GitHub
parent fc71f98bed
commit 977de5b324
8 changed files with 11 additions and 3 deletions

View File

@@ -112,9 +112,7 @@ namespace {{packageName}}.{{clientPackage}}
/// </summary>
public T{{nrt?}} ToModel(System.Text.Json.JsonSerializerOptions{{nrt?}} options = null)
{
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);
{{>ToModel}}
}
/// <summary>

View File

@@ -0,0 +1,4 @@
// This logic may be modified with the ToModel.mustache template
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);

View File

@@ -118,6 +118,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
public T? ToModel(System.Text.Json.JsonSerializerOptions? options = null)
{
// This logic may be modified with the ToModel.mustache template
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);

View File

@@ -116,6 +116,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
public T ToModel(System.Text.Json.JsonSerializerOptions options = null)
{
// This logic may be modified with the ToModel.mustache template
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);

View File

@@ -118,6 +118,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
public T? ToModel(System.Text.Json.JsonSerializerOptions? options = null)
{
// This logic may be modified with the ToModel.mustache template
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);

View File

@@ -118,6 +118,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
public T? ToModel(System.Text.Json.JsonSerializerOptions? options = null)
{
// This logic may be modified with the ToModel.mustache template
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);

View File

@@ -118,6 +118,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
public T? ToModel(System.Text.Json.JsonSerializerOptions? options = null)
{
// This logic may be modified with the ToModel.mustache template
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);

View File

@@ -116,6 +116,7 @@ namespace Org.OpenAPITools.Client
/// </summary>
public T ToModel(System.Text.Json.JsonSerializerOptions options = null)
{
// This logic may be modified with the ToModel.mustache template
return IsSuccessStatusCode
? System.Text.Json.JsonSerializer.Deserialize<T>(RawContent, options ?? _jsonSerializerOptions)
: default(T);