From 0f8b47e12b2caba995092e8e58c4138178f52018 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Mar 2026 02:40:13 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Together/Generated/Together.AllOf.2.g.cs | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/libs/Together/Generated/Together.AllOf.2.g.cs b/src/libs/Together/Generated/Together.AllOf.2.g.cs index 16b8f5be..94422007 100644 --- a/src/libs/Together/Generated/Together.AllOf.2.g.cs +++ b/src/libs/Together/Generated/Together.AllOf.2.g.cs @@ -105,12 +105,51 @@ Value1 as object Value2?.ToString() ; + private static bool RequiresValue() => RequirementCache.Value; + + private static bool DetermineRequiresValue(global::System.Type type) + { + if (global::System.Nullable.GetUnderlyingType(type) != null) + { + return false; + } + + if (type.IsValueType || + type == typeof(string) || + type.IsArray) + { + return true; + } + + foreach (var property in type.GetProperties(global::System.Reflection.BindingFlags.Instance | global::System.Reflection.BindingFlags.Public)) + { + foreach (var attributeData in property.CustomAttributes) + { + var attributeTypeName = attributeData.AttributeType.FullName; + if (attributeTypeName == "System.Text.Json.Serialization.JsonRequiredAttribute" || + attributeTypeName == "Newtonsoft.Json.JsonRequiredAttribute" || + attributeTypeName == "System.Runtime.CompilerServices.RequiredMemberAttribute") + { + return true; + } + } + } + + return false; + } + + private static class RequirementCache + { + public static readonly bool Value = DetermineRequiresValue(typeof(TValue)); + } + + /// /// /// public bool Validate() { - return IsValue1 && IsValue2; + return (!RequiresValue() || IsValue1) && (!RequiresValue() || IsValue2); } ///