diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceIndexResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceIndexResource.g.cs index c889ca8..e89db39 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceIndexResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceIndexResource.g.cs @@ -17,65 +17,20 @@ public class AccessTokenCustomerServiceIndexResourceJsonConverter : global::Syst using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("customer_limits")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("token")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.AccessTokenServiceResource? accessTokenServiceResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); - accessTokenServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); + accessTokenServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (accessTokenServiceResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); - accessTokenServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.AccessTokenCustomerServiceIndexResource( accessTokenServiceResource ); @@ -92,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsAccessTokenServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AccessTokenServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AccessTokenServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceShow.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceShow.g.cs index 5fcae80..726f0f0 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceShow.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenCustomerServiceShow.g.cs @@ -17,65 +17,20 @@ public class AccessTokenCustomerServiceShowJsonConverter : global::System.Text.J using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("customer_limits")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("token")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.AccessTokenServiceResource? resource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); + resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (resource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.AccessTokenCustomerServiceShow( resource ); @@ -92,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Resource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Resource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenIndexPublicResource.g.cs index 7154fdf..c5097d5 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenIndexPublicResource.g.cs @@ -17,65 +17,20 @@ public class AccessTokenIndexPublicResourceJsonConverter : global::System.Text.J using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("customer_limits")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("token")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.AccessTokenPublicResource? accessTokenPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); - accessTokenPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); + accessTokenPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (accessTokenPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); - accessTokenPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.AccessTokenIndexPublicResource( accessTokenPublicResource ); @@ -92,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsAccessTokenPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AccessTokenPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AccessTokenPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenShowPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenShowPublicResource.g.cs index 20c4a65..4196fae 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenShowPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.AccessTokenShowPublicResource.g.cs @@ -17,65 +17,20 @@ public class AccessTokenShowPublicResourceJsonConverter : global::System.Text.Js using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("customer_limits")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("token")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.AccessTokenPublicResource? accessTokenPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); - accessTokenPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); + accessTokenPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (accessTokenPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); - accessTokenPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.AccessTokenShowPublicResource( accessTokenPublicResource ); @@ -92,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsAccessTokenPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.AccessTokenPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.AccessTokenPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AccessTokenPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AccessTokenPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceIndexResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceIndexResource.g.cs index 69ca18f..36956cd 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceIndexResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceIndexResource.g.cs @@ -17,61 +17,20 @@ public class CompanyCustomerServiceIndexResourceJsonConverter : global::System.T using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CompanyServiceResource? companyServiceResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); - companyServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); + companyServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (companyServiceResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); - companyServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CompanyCustomerServiceIndexResource( companyServiceResource ); @@ -88,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCompanyServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CompanyServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CompanyServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceShow.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceShow.g.cs index dae10a1..075dc0e 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceShow.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyCustomerServiceShow.g.cs @@ -17,61 +17,20 @@ public class CompanyCustomerServiceShowJsonConverter : global::System.Text.Json. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CompanyServiceResource? resource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); + resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (resource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CompanyCustomerServiceShow( resource ); @@ -88,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Resource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Resource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyIndexPublicResource.g.cs index 917e17e..b0b864a 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyIndexPublicResource.g.cs @@ -17,61 +17,20 @@ public class CompanyIndexPublicResourceJsonConverter : global::System.Text.Json. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CompanyPublicResource? companyPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); - companyPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); + companyPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (companyPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); - companyPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CompanyIndexPublicResource( companyPublicResource ); @@ -88,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCompanyPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CompanyPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CompanyPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyShowPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyShowPublicResource.g.cs index c3af3a4..61973a2 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyShowPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CompanyShowPublicResource.g.cs @@ -17,61 +17,20 @@ public class CompanyShowPublicResourceJsonConverter : global::System.Text.Json.S using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CompanyPublicResource? companyPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); - companyPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); + companyPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (companyPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); - companyPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CompanyShowPublicResource( companyPublicResource ); @@ -88,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCompanyPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CompanyPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CompanyPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CompanyPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CompanyPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerCustomerServiceShowResourceResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerCustomerServiceShowResourceResource.g.cs index 6d4b7ba..d1784a3 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerCustomerServiceShowResourceResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerCustomerServiceShowResourceResource.g.cs @@ -17,99 +17,34 @@ public class CustomerCustomerServiceShowResourceResourceJsonConverter : global:: using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.CustomerServiceResource? customerServiceResource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerServiceResource).Name}"); + customerServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("company_id")) __score0++; - if (__jsonProps.Contains("custom_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("access")) __score1++; - if (__jsonProps.Contains("company")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.CustomerServiceResource? customerServiceResource = default; global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2? customerCustomerServiceShowResourceResourceVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerServiceResource).Name}"); - customerServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2).Name}"); - customerCustomerServiceShowResourceResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2).Name}"); + customerCustomerServiceShowResourceResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (customerServiceResource == null && customerCustomerServiceShowResourceResourceVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerServiceResource).Name}"); - customerServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (customerServiceResource == null && customerCustomerServiceShowResourceResourceVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2).Name}"); - customerCustomerServiceShowResourceResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CustomerCustomerServiceShowResourceResource( customerServiceResource, @@ -128,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCustomerServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomerServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomerServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsCustomerCustomerServiceShowResourceResourceVariant2) + if (value.IsCustomerCustomerServiceShowResourceResourceVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerCustomerServiceShowResourceResourceVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomerCustomerServiceShowResourceResourceVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomerCustomerServiceShowResourceResourceVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceIndexResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceIndexResource.g.cs index f664c23..69a9fa9 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceIndexResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceIndexResource.g.cs @@ -17,82 +17,20 @@ public class CustomerLicenseLimitCustomerServiceIndexResourceJsonConverter : glo using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("daily_reset_at")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_count")) __score0++; - if (__jsonProps.Contains("daily_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("max_concurrent_track_generations")) __score0++; - if (__jsonProps.Contains("monthly_reset_at")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("total_streaming_duration")) __score0++; - if (__jsonProps.Contains("total_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_count")) __score0++; - if (__jsonProps.Contains("total_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_duration")) __score0++; - if (__jsonProps.Contains("total_tracks_duration_limit")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CustomerLicenseLimitServiceResource? customerLicenseLimitServiceResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); - customerLicenseLimitServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); + customerLicenseLimitServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (customerLicenseLimitServiceResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); - customerLicenseLimitServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CustomerLicenseLimitCustomerServiceIndexResource( customerLicenseLimitServiceResource ); @@ -109,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCustomerLicenseLimitServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomerLicenseLimitServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomerLicenseLimitServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceShow.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceShow.g.cs index dbee267..bbfe8ff 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceShow.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitCustomerServiceShow.g.cs @@ -17,82 +17,20 @@ public class CustomerLicenseLimitCustomerServiceShowJsonConverter : global::Syst using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("daily_reset_at")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_count")) __score0++; - if (__jsonProps.Contains("daily_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("max_concurrent_track_generations")) __score0++; - if (__jsonProps.Contains("monthly_reset_at")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("total_streaming_duration")) __score0++; - if (__jsonProps.Contains("total_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_count")) __score0++; - if (__jsonProps.Contains("total_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_duration")) __score0++; - if (__jsonProps.Contains("total_tracks_duration_limit")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CustomerLicenseLimitServiceResource? resource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); + resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (resource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CustomerLicenseLimitCustomerServiceShow( resource ); @@ -109,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Resource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Resource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitIndexPublicResource.g.cs index bcb78d7..a996f4d 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitIndexPublicResource.g.cs @@ -17,82 +17,20 @@ public class CustomerLicenseLimitIndexPublicResourceJsonConverter : global::Syst using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("daily_reset_at")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_count")) __score0++; - if (__jsonProps.Contains("daily_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("max_concurrent_track_generations")) __score0++; - if (__jsonProps.Contains("monthly_reset_at")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("total_streaming_duration")) __score0++; - if (__jsonProps.Contains("total_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_count")) __score0++; - if (__jsonProps.Contains("total_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_duration")) __score0++; - if (__jsonProps.Contains("total_tracks_duration_limit")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CustomerLicenseLimitPublicResource? customerLicenseLimitPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); - customerLicenseLimitPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); + customerLicenseLimitPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (customerLicenseLimitPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); - customerLicenseLimitPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CustomerLicenseLimitIndexPublicResource( customerLicenseLimitPublicResource ); @@ -109,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCustomerLicenseLimitPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomerLicenseLimitPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomerLicenseLimitPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitShowPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitShowPublicResource.g.cs index 069dd11..e4cfbb8 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitShowPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerLicenseLimitShowPublicResource.g.cs @@ -17,82 +17,20 @@ public class CustomerLicenseLimitShowPublicResourceJsonConverter : global::Syste using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("customer_id")) __score0++; - if (__jsonProps.Contains("daily_reset_at")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration")) __score0++; - if (__jsonProps.Contains("daily_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_count")) __score0++; - if (__jsonProps.Contains("daily_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration")) __score0++; - if (__jsonProps.Contains("daily_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("license_id")) __score0++; - if (__jsonProps.Contains("max_concurrent_track_generations")) __score0++; - if (__jsonProps.Contains("monthly_reset_at")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration")) __score0++; - if (__jsonProps.Contains("monthly_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count")) __score0++; - if (__jsonProps.Contains("monthly_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration")) __score0++; - if (__jsonProps.Contains("monthly_tracks_duration_limit")) __score0++; - if (__jsonProps.Contains("total_streaming_duration")) __score0++; - if (__jsonProps.Contains("total_streaming_duration_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_count")) __score0++; - if (__jsonProps.Contains("total_tracks_count_limit")) __score0++; - if (__jsonProps.Contains("total_tracks_duration")) __score0++; - if (__jsonProps.Contains("total_tracks_duration_limit")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.CustomerLicenseLimitPublicResource? customerLicenseLimitPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); - customerLicenseLimitPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); + customerLicenseLimitPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (customerLicenseLimitPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); - customerLicenseLimitPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CustomerLicenseLimitShowPublicResource( customerLicenseLimitPublicResource ); @@ -109,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCustomerLicenseLimitPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerLicenseLimitPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerLicenseLimitPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomerLicenseLimitPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomerLicenseLimitPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerShowPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerShowPublicResource.g.cs index 30bdf7d..39fe0cb 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerShowPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.CustomerShowPublicResource.g.cs @@ -17,99 +17,34 @@ public class CustomerShowPublicResourceJsonConverter : global::System.Text.Json. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.CustomerPublicResource? customerPublicResource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerPublicResource).Name}"); + customerPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("company_id")) __score0++; - if (__jsonProps.Contains("custom_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("access")) __score1++; - if (__jsonProps.Contains("company")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.CustomerPublicResource? customerPublicResource = default; global::Mubert.CustomerShowPublicResourceVariant2? customerShowPublicResourceVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerPublicResource).Name}"); - customerPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerShowPublicResourceVariant2).Name}"); - customerShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerShowPublicResourceVariant2).Name}"); + customerShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (customerPublicResource == null && customerShowPublicResourceVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerPublicResource).Name}"); - customerPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (customerPublicResource == null && customerShowPublicResourceVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerShowPublicResourceVariant2).Name}"); - customerShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.CustomerShowPublicResource( customerPublicResource, @@ -128,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCustomerPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomerPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomerPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsCustomerShowPublicResourceVariant2) + if (value.IsCustomerShowPublicResourceVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.CustomerShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.CustomerShowPublicResourceVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomerShowPublicResourceVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomerShowPublicResourceVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseCustomerServiceIndex.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseCustomerServiceIndex.g.cs index 243de4a..324ae9d 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseCustomerServiceIndex.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseCustomerServiceIndex.g.cs @@ -17,81 +17,20 @@ public class LicenseCustomerServiceIndexJsonConverter : global::System.Text.Json using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("allow_all_bitrates")) __score0++; - if (__jsonProps.Contains("allow_all_features")) __score0++; - if (__jsonProps.Contains("allow_all_formats")) __score0++; - if (__jsonProps.Contains("allow_all_intensities")) __score0++; - if (__jsonProps.Contains("allow_all_modes")) __score0++; - if (__jsonProps.Contains("bitrates")) __score0++; - if (__jsonProps.Contains("company_id")) __score0++; - if (__jsonProps.Contains("default_bitrate")) __score0++; - if (__jsonProps.Contains("default_format")) __score0++; - if (__jsonProps.Contains("default_intensity")) __score0++; - if (__jsonProps.Contains("default_mode")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("features")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("intensities")) __score0++; - if (__jsonProps.Contains("license_limits")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - if (__jsonProps.Contains("track_expiration_time")) __score0++; - if (__jsonProps.Contains("track_formats")) __score0++; - if (__jsonProps.Contains("track_modes")) __score0++; - if (__jsonProps.Contains("type")) __score0++; - if (__jsonProps.Contains("webhook_enabled")) __score0++; - if (__jsonProps.Contains("webhook_url")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.LicenseServiceResource? resource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicenseServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicenseServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicenseServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicenseServiceResource).Name}"); + resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (resource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicenseServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicenseServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.LicenseCustomerServiceIndex( resource ); @@ -108,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicenseServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicenseServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Resource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Resource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseIndexPublicResource.g.cs index be6b53d..f8881c0 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.LicenseIndexPublicResource.g.cs @@ -17,82 +17,20 @@ public class LicenseIndexPublicResourceJsonConverter : global::System.Text.Json. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("allow_all_bitrates")) __score0++; - if (__jsonProps.Contains("allow_all_features")) __score0++; - if (__jsonProps.Contains("allow_all_formats")) __score0++; - if (__jsonProps.Contains("allow_all_intensities")) __score0++; - if (__jsonProps.Contains("allow_all_modes")) __score0++; - if (__jsonProps.Contains("bitrates")) __score0++; - if (__jsonProps.Contains("company_id")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("default_bitrate")) __score0++; - if (__jsonProps.Contains("default_format")) __score0++; - if (__jsonProps.Contains("default_intensity")) __score0++; - if (__jsonProps.Contains("default_mode")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("features")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("intensities")) __score0++; - if (__jsonProps.Contains("license_limits")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - if (__jsonProps.Contains("track_expiration_time")) __score0++; - if (__jsonProps.Contains("track_formats")) __score0++; - if (__jsonProps.Contains("track_modes")) __score0++; - if (__jsonProps.Contains("type")) __score0++; - if (__jsonProps.Contains("webhook_enabled")) __score0++; - if (__jsonProps.Contains("webhook_url")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.LicensePublicResource? licensePublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicensePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicensePublicResource).Name}"); - licensePublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicensePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicensePublicResource).Name}"); + licensePublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (licensePublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicensePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicensePublicResource).Name}"); - licensePublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.LicenseIndexPublicResource( licensePublicResource ); @@ -109,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsLicensePublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.LicensePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.LicensePublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.LicensePublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.LicensePublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.MetadataPaginationSortable.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.MetadataPaginationSortable.g.cs index 34a3d60..b2966b7 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.MetadataPaginationSortable.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.MetadataPaginationSortable.g.cs @@ -17,98 +17,34 @@ public class MetadataPaginationSortableJsonConverter : global::System.Text.Json. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.MetadataPagination? metadataPagination = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPagination), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPagination).Name}"); + metadataPagination = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("limit")) __score0++; - if (__jsonProps.Contains("offset")) __score0++; - if (__jsonProps.Contains("total")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("order")) __score1++; - if (__jsonProps.Contains("order_by")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.MetadataPagination? metadataPagination = default; global::Mubert.MetadataPaginationSortableVariant2? metadataPaginationSortableVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPagination), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPagination).Name}"); - metadataPagination = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPaginationSortableVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPaginationSortableVariant2).Name}"); - metadataPaginationSortableVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPaginationSortableVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPaginationSortableVariant2).Name}"); + metadataPaginationSortableVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (metadataPagination == null && metadataPaginationSortableVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPagination), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPagination).Name}"); - metadataPagination = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (metadataPagination == null && metadataPaginationSortableVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPaginationSortableVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPaginationSortableVariant2).Name}"); - metadataPaginationSortableVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.MetadataPaginationSortable( metadataPagination, @@ -127,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsMetadataPagination) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPagination), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPagination).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.MetadataPagination!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.MetadataPagination!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsMetadataPaginationSortableVariant2) + if (value.IsMetadataPaginationSortableVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.MetadataPaginationSortableVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.MetadataPaginationSortableVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.MetadataPaginationSortableVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.MetadataPaginationSortableVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistCustomerServiceIndexResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistCustomerServiceIndexResource.g.cs index 8d6a832..1958f6a 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistCustomerServiceIndexResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistCustomerServiceIndexResource.g.cs @@ -17,62 +17,20 @@ public class PlaylistCustomerServiceIndexResourceJsonConverter : global::System. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("category")) __score0++; - if (__jsonProps.Contains("channel")) __score0++; - if (__jsonProps.Contains("group")) __score0++; - if (__jsonProps.Contains("playlist_index")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.PlaylistServiceResource? playlistServiceResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistServiceResource).Name}"); - playlistServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistServiceResource).Name}"); + playlistServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (playlistServiceResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistServiceResource).Name}"); - playlistServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.PlaylistCustomerServiceIndexResource( playlistServiceResource ); @@ -89,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsPlaylistServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.PlaylistServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PlaylistServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistIndexPublicResource.g.cs index 5b25f02..55ebca7 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.PlaylistIndexPublicResource.g.cs @@ -17,63 +17,20 @@ public class PlaylistIndexPublicResourceJsonConverter : global::System.Text.Json using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("category")) __score0++; - if (__jsonProps.Contains("channel")) __score0++; - if (__jsonProps.Contains("group")) __score0++; - if (__jsonProps.Contains("params")) __score0++; - if (__jsonProps.Contains("playlist_index")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.PlaylistPublicResource? playlistPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistPublicResource).Name}"); - playlistPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistPublicResource).Name}"); + playlistPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (playlistPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistPublicResource).Name}"); - playlistPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.PlaylistIndexPublicResource( playlistPublicResource ); @@ -90,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsPlaylistPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.PlaylistPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.PlaylistPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.PlaylistPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PlaylistPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceIndexResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceIndexResource.g.cs index bbd202d..b01fd97 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceIndexResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceIndexResource.g.cs @@ -17,103 +17,34 @@ public class TrackCustomerServiceIndexResourceJsonConverter : global::System.Tex using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.TrackServiceResource? trackServiceResource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); + trackServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("bpm")) __score0++; - if (__jsonProps.Contains("duration")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("intensity")) __score0++; - if (__jsonProps.Contains("key")) __score0++; - if (__jsonProps.Contains("mode")) __score0++; - if (__jsonProps.Contains("playlist_index")) __score0++; - if (__jsonProps.Contains("prompt")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("generations")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.TrackServiceResource? trackServiceResource = default; global::Mubert.TrackCustomerServiceIndexResourceVariant2? trackCustomerServiceIndexResourceVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); - trackServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2).Name}"); - trackCustomerServiceIndexResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2).Name}"); + trackCustomerServiceIndexResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackServiceResource == null && trackCustomerServiceIndexResourceVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); - trackServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (trackServiceResource == null && trackCustomerServiceIndexResourceVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2).Name}"); - trackCustomerServiceIndexResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackCustomerServiceIndexResource( trackServiceResource, @@ -132,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTrackCustomerServiceIndexResourceVariant2) + if (value.IsTrackCustomerServiceIndexResourceVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceIndexResourceVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackCustomerServiceIndexResourceVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackCustomerServiceIndexResourceVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceShow.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceShow.g.cs index 4a51fdf..69c3a32 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceShow.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackCustomerServiceShow.g.cs @@ -17,103 +17,34 @@ public class TrackCustomerServiceShowJsonConverter : global::System.Text.Json.Se using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.TrackServiceResource? resource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); + resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("bpm")) __score0++; - if (__jsonProps.Contains("duration")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("intensity")) __score0++; - if (__jsonProps.Contains("key")) __score0++; - if (__jsonProps.Contains("mode")) __score0++; - if (__jsonProps.Contains("playlist_index")) __score0++; - if (__jsonProps.Contains("prompt")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("generations")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.TrackServiceResource? resource = default; global::Mubert.TrackCustomerServiceShowVariant2? trackCustomerServiceShowVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceShowVariant2).Name}"); - trackCustomerServiceShowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceShowVariant2).Name}"); + trackCustomerServiceShowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (resource == null && trackCustomerServiceShowVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (resource == null && trackCustomerServiceShowVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceShowVariant2).Name}"); - trackCustomerServiceShowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackCustomerServiceShow( resource, @@ -132,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Resource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Resource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTrackCustomerServiceShowVariant2) + if (value.IsTrackCustomerServiceShowVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackCustomerServiceShowVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackCustomerServiceShowVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackCustomerServiceShowVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceIndexResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceIndexResource.g.cs index 6825f06..3962d3a 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceIndexResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceIndexResource.g.cs @@ -17,65 +17,20 @@ public class TrackGenerationCustomerServiceIndexResourceJsonConverter : global:: using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("bitrate")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("format")) __score0++; - if (__jsonProps.Contains("generated_at")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.TrackGenerationServiceResource? trackGenerationServiceResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); - trackGenerationServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); + trackGenerationServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackGenerationServiceResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); - trackGenerationServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackGenerationCustomerServiceIndexResource( trackGenerationServiceResource ); @@ -92,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackGenerationServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackGenerationServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackGenerationServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceShow.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceShow.g.cs index 58a6c05..e57cd0f 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceShow.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationCustomerServiceShow.g.cs @@ -17,101 +17,34 @@ public class TrackGenerationCustomerServiceShowJsonConverter : global::System.Te using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.TrackGenerationServiceResource? resource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); + resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("bitrate")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("format")) __score0++; - if (__jsonProps.Contains("generated_at")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("url")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.TrackGenerationServiceResource? resource = default; global::Mubert.TrackGenerationCustomerServiceShowVariant2? trackGenerationCustomerServiceShowVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2).Name}"); - trackGenerationCustomerServiceShowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2).Name}"); + trackGenerationCustomerServiceShowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (resource == null && trackGenerationCustomerServiceShowVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); - resource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (resource == null && trackGenerationCustomerServiceShowVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2).Name}"); - trackGenerationCustomerServiceShowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackGenerationCustomerServiceShow( resource, @@ -130,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Resource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Resource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTrackGenerationCustomerServiceShowVariant2) + if (value.IsTrackGenerationCustomerServiceShowVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationCustomerServiceShowVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackGenerationCustomerServiceShowVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackGenerationCustomerServiceShowVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationIndexPublicResource.g.cs index 3b19547..4288c05 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationIndexPublicResource.g.cs @@ -17,65 +17,20 @@ public class TrackGenerationIndexPublicResourceJsonConverter : global::System.Te using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("bitrate")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("format")) __score0++; - if (__jsonProps.Contains("generated_at")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.TrackGenerationPublicResource? trackGenerationPublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); - trackGenerationPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); + trackGenerationPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackGenerationPublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); - trackGenerationPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackGenerationIndexPublicResource( trackGenerationPublicResource ); @@ -92,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackGenerationPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackGenerationPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackGenerationPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationShowPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationShowPublicResource.g.cs index 934d9a1..b8c6b56 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationShowPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackGenerationShowPublicResource.g.cs @@ -17,101 +17,34 @@ public class TrackGenerationShowPublicResourceJsonConverter : global::System.Tex using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.TrackGenerationPublicResource? trackGenerationPublicResource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); + trackGenerationPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("bitrate")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("expired_at")) __score0++; - if (__jsonProps.Contains("format")) __score0++; - if (__jsonProps.Contains("generated_at")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - if (__jsonProps.Contains("status")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("url")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.TrackGenerationPublicResource? trackGenerationPublicResource = default; global::Mubert.TrackGenerationShowPublicResourceVariant2? trackGenerationShowPublicResourceVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); - trackGenerationPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2).Name}"); - trackGenerationShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2).Name}"); + trackGenerationShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackGenerationPublicResource == null && trackGenerationShowPublicResourceVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); - trackGenerationPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (trackGenerationPublicResource == null && trackGenerationShowPublicResourceVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2).Name}"); - trackGenerationShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackGenerationShowPublicResource( trackGenerationPublicResource, @@ -130,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackGenerationPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackGenerationPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackGenerationPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTrackGenerationShowPublicResourceVariant2) + if (value.IsTrackGenerationShowPublicResourceVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackGenerationShowPublicResourceVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackGenerationShowPublicResourceVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackGenerationShowPublicResourceVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackIndexPublicResource.g.cs index afd5dd4..4ab64d6 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackIndexPublicResource.g.cs @@ -17,104 +17,34 @@ public class TrackIndexPublicResourceJsonConverter : global::System.Text.Json.Se using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.TrackPublicResource? trackPublicResource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); + trackPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("bpm")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("duration")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("intensity")) __score0++; - if (__jsonProps.Contains("key")) __score0++; - if (__jsonProps.Contains("mode")) __score0++; - if (__jsonProps.Contains("playlist_index")) __score0++; - if (__jsonProps.Contains("prompt")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("generations")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.TrackPublicResource? trackPublicResource = default; global::Mubert.TrackIndexPublicResourceVariant2? trackIndexPublicResourceVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); - trackPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackIndexPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackIndexPublicResourceVariant2).Name}"); - trackIndexPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackIndexPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackIndexPublicResourceVariant2).Name}"); + trackIndexPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackPublicResource == null && trackIndexPublicResourceVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); - trackPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (trackPublicResource == null && trackIndexPublicResourceVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackIndexPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackIndexPublicResourceVariant2).Name}"); - trackIndexPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackIndexPublicResource( trackPublicResource, @@ -133,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTrackIndexPublicResourceVariant2) + if (value.IsTrackIndexPublicResourceVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackIndexPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackIndexPublicResourceVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackIndexPublicResourceVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackIndexPublicResourceVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackShowPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackShowPublicResource.g.cs index cfb4bb5..5cbb03f 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackShowPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackShowPublicResource.g.cs @@ -17,104 +17,34 @@ public class TrackShowPublicResourceJsonConverter : global::System.Text.Json.Ser using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::Mubert.TrackPublicResource? trackPublicResource = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); + trackPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("bpm")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("duration")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("intensity")) __score0++; - if (__jsonProps.Contains("key")) __score0++; - if (__jsonProps.Contains("mode")) __score0++; - if (__jsonProps.Contains("playlist_index")) __score0++; - if (__jsonProps.Contains("prompt")) __score0++; - if (__jsonProps.Contains("session_id")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("generations")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::Mubert.TrackPublicResource? trackPublicResource = default; global::Mubert.TrackShowPublicResourceVariant2? trackShowPublicResourceVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); - trackPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackShowPublicResourceVariant2).Name}"); - trackShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackShowPublicResourceVariant2).Name}"); + trackShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackPublicResource == null && trackShowPublicResourceVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); - trackPublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (trackPublicResource == null && trackShowPublicResourceVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackShowPublicResourceVariant2).Name}"); - trackShowPublicResourceVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackShowPublicResource( trackPublicResource, @@ -133,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackPublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackPublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackPublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackPublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackPublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTrackShowPublicResourceVariant2) + if (value.IsTrackShowPublicResourceVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackShowPublicResourceVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackShowPublicResourceVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackShowPublicResourceVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackShowPublicResourceVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreCustomerServiceIndexResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreCustomerServiceIndexResource.g.cs index 6aa5a0a..b493e40 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreCustomerServiceIndexResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreCustomerServiceIndexResource.g.cs @@ -17,65 +17,20 @@ public class TrackStoreCustomerServiceIndexResourceJsonConverter : global::Syste using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("bitrates")) __score0++; - if (__jsonProps.Contains("company_id")) __score0++; - if (__jsonProps.Contains("durations")) __score0++; - if (__jsonProps.Contains("formats")) __score0++; - if (__jsonProps.Contains("intensities")) __score0++; - if (__jsonProps.Contains("modes")) __score0++; - if (__jsonProps.Contains("tracks_amount")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.TrackStoreServiceResource? trackStoreServiceResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStoreServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStoreServiceResource).Name}"); - trackStoreServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStoreServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStoreServiceResource).Name}"); + trackStoreServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackStoreServiceResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStoreServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStoreServiceResource).Name}"); - trackStoreServiceResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackStoreCustomerServiceIndexResource( trackStoreServiceResource ); @@ -92,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackStoreServiceResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStoreServiceResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStoreServiceResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackStoreServiceResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackStoreServiceResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreIndexPublicResource.g.cs b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreIndexPublicResource.g.cs index ea9bbe4..d013418 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreIndexPublicResource.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonConverters.TrackStoreIndexPublicResource.g.cs @@ -17,66 +17,20 @@ public class TrackStoreIndexPublicResourceJsonConverter : global::System.Text.Js using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - - } - } - - var __score0 = 0; - if (__jsonProps.Contains("bitrates")) __score0++; - if (__jsonProps.Contains("company_id")) __score0++; - if (__jsonProps.Contains("created_at")) __score0++; - if (__jsonProps.Contains("durations")) __score0++; - if (__jsonProps.Contains("formats")) __score0++; - if (__jsonProps.Contains("intensities")) __score0++; - if (__jsonProps.Contains("modes")) __score0++; - if (__jsonProps.Contains("tracks_amount")) __score0++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } global::Mubert.TrackStorePublicResource? trackStorePublicResource = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStorePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStorePublicResource).Name}"); - trackStorePublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStorePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStorePublicResource).Name}"); + trackStorePublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (trackStorePublicResource == null) + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStorePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStorePublicResource).Name}"); - trackStorePublicResource = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::Mubert.TrackStoreIndexPublicResource( trackStorePublicResource ); @@ -93,12 +47,28 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsTrackStorePublicResource) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mubert.TrackStorePublicResource), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mubert.TrackStorePublicResource).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TrackStorePublicResource!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TrackStorePublicResource!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/Mubert/Generated/Mubert.JsonSerializerContext.g.cs b/src/libs/Mubert/Generated/Mubert.JsonSerializerContext.g.cs index 8488c96..de7a442 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonSerializerContext.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonSerializerContext.g.cs @@ -242,6 +242,7 @@ namespace Mubert typeof(global::Mubert.JsonConverters.UnixTimestampJsonConverter), })] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Mubert.JsonSerializerContextTypes))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "SystemCollectionsGeneric_ObjectList")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Mubert.CommentModelTypeEnum), TypeInfoPropertyName = "CommentModelTypeEnum2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Mubert.CompanyStatusEnum), TypeInfoPropertyName = "CompanyStatusEnum2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Mubert.CustomerStatusEnum), TypeInfoPropertyName = "CustomerStatusEnum2")] diff --git a/src/libs/Mubert/Generated/Mubert.JsonSerializerContextTypes.g.cs b/src/libs/Mubert/Generated/Mubert.JsonSerializerContextTypes.g.cs index 025cafd..e39b90c 100644 --- a/src/libs/Mubert/Generated/Mubert.JsonSerializerContextTypes.g.cs +++ b/src/libs/Mubert/Generated/Mubert.JsonSerializerContextTypes.g.cs @@ -20,6 +20,11 @@ public sealed partial class JsonSerializerContextTypes /// public global::System.Collections.Generic.Dictionary? StringObjectDictionary { get; set; } + /// + /// Runtime object lists used by dynamic JSON payloads such as tool arguments. + /// + public global::System.Collections.Generic.List? ObjectList { get; set; } + /// /// ///