diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.2.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.2.g.cs index dfda705..57cb7fb 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.2.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.2.g.cs @@ -41,8 +41,8 @@ public bool TryPickValue1( /// /// /// - public T1 PickValue1() => IsValue1 - ? Value1! + public T1 PickValue1() => Value1 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}."); /// @@ -78,8 +78,8 @@ public bool TryPickValue2( /// /// /// - public T2 PickValue2() => IsValue2 - ? Value2! + public T2 PickValue2() => Value2 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}."); /// /// @@ -176,13 +176,13 @@ public bool Validate() Validate(); } - if (IsValue1 && value1 != null) + if (Value1 is { } __value0 && value1 != null) { - return value1(Value1!); + return value1(__value0); } - else if (IsValue2 && value2 != null) + else if (Value2 is { } __value1 && value2 != null) { - return value2(Value2!); + return value2(__value1); } return default(TResult); @@ -202,13 +202,13 @@ public void Match( Validate(); } - if (IsValue1) + if (Value1 is { } __value0) { - value1?.Invoke(Value1!); + value1?.Invoke(__value0); } - else if (IsValue2) + else if (Value2 is { } __value1) { - value2?.Invoke(Value2!); + value2?.Invoke(__value1); } } @@ -225,13 +225,13 @@ public void Switch( Validate(); } - if (IsValue1) + if (Value1 is { } __value0) { - value1?.Invoke(Value1!); + value1?.Invoke(__value0); } - else if (IsValue2) + else if (Value2 is { } __value1) { - value2?.Invoke(Value2!); + value2?.Invoke(__value1); } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.3.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.3.g.cs index 123d442..b385b13 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.3.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.3.g.cs @@ -41,8 +41,8 @@ public bool TryPickValue1( /// /// /// - public T1 PickValue1() => IsValue1 - ? Value1! + public T1 PickValue1() => Value1 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}."); /// @@ -78,8 +78,8 @@ public bool TryPickValue2( /// /// /// - public T2 PickValue2() => IsValue2 - ? Value2! + public T2 PickValue2() => Value2 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}."); /// @@ -115,8 +115,8 @@ public bool TryPickValue3( /// /// /// - public T3 PickValue3() => IsValue3 - ? Value3! + public T3 PickValue3() => Value3 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value3' but the value was {ToString()}."); /// /// @@ -241,17 +241,17 @@ public bool Validate() Validate(); } - if (IsValue1 && value1 != null) + if (Value1 is { } __value0 && value1 != null) { - return value1(Value1!); + return value1(__value0); } - else if (IsValue2 && value2 != null) + else if (Value2 is { } __value1 && value2 != null) { - return value2(Value2!); + return value2(__value1); } - else if (IsValue3 && value3 != null) + else if (Value3 is { } __value2 && value3 != null) { - return value3(Value3!); + return value3(__value2); } return default(TResult); @@ -273,17 +273,17 @@ public void Match( Validate(); } - if (IsValue1) + if (Value1 is { } __value0) { - value1?.Invoke(Value1!); + value1?.Invoke(__value0); } - else if (IsValue2) + else if (Value2 is { } __value1) { - value2?.Invoke(Value2!); + value2?.Invoke(__value1); } - else if (IsValue3) + else if (Value3 is { } __value2) { - value3?.Invoke(Value3!); + value3?.Invoke(__value2); } } @@ -301,17 +301,17 @@ public void Switch( Validate(); } - if (IsValue1) + if (Value1 is { } __value0) { - value1?.Invoke(Value1!); + value1?.Invoke(__value0); } - else if (IsValue2) + else if (Value2 is { } __value1) { - value2?.Invoke(Value2!); + value2?.Invoke(__value1); } - else if (IsValue3) + else if (Value3 is { } __value2) { - value3?.Invoke(Value3!); + value3?.Invoke(__value2); } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.4.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.4.g.cs index 382ab09..ec17fc3 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.4.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AnyOf.4.g.cs @@ -41,8 +41,8 @@ public bool TryPickValue1( /// /// /// - public T1 PickValue1() => IsValue1 - ? Value1! + public T1 PickValue1() => Value1 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}."); /// @@ -78,8 +78,8 @@ public bool TryPickValue2( /// /// /// - public T2 PickValue2() => IsValue2 - ? Value2! + public T2 PickValue2() => Value2 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}."); /// @@ -115,8 +115,8 @@ public bool TryPickValue3( /// /// /// - public T3 PickValue3() => IsValue3 - ? Value3! + public T3 PickValue3() => Value3 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value3' but the value was {ToString()}."); /// @@ -152,8 +152,8 @@ public bool TryPickValue4( /// /// /// - public T4 PickValue4() => IsValue4 - ? Value4! + public T4 PickValue4() => Value4 is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Value4' but the value was {ToString()}."); /// /// @@ -306,21 +306,21 @@ public bool Validate() Validate(); } - if (IsValue1 && value1 != null) + if (Value1 is { } __value0 && value1 != null) { - return value1(Value1!); + return value1(__value0); } - else if (IsValue2 && value2 != null) + else if (Value2 is { } __value1 && value2 != null) { - return value2(Value2!); + return value2(__value1); } - else if (IsValue3 && value3 != null) + else if (Value3 is { } __value2 && value3 != null) { - return value3(Value3!); + return value3(__value2); } - else if (IsValue4 && value4 != null) + else if (Value4 is { } __value3 && value4 != null) { - return value4(Value4!); + return value4(__value3); } return default(TResult); @@ -344,21 +344,21 @@ public void Match( Validate(); } - if (IsValue1) + if (Value1 is { } __value0) { - value1?.Invoke(Value1!); + value1?.Invoke(__value0); } - else if (IsValue2) + else if (Value2 is { } __value1) { - value2?.Invoke(Value2!); + value2?.Invoke(__value1); } - else if (IsValue3) + else if (Value3 is { } __value2) { - value3?.Invoke(Value3!); + value3?.Invoke(__value2); } - else if (IsValue4) + else if (Value4 is { } __value3) { - value4?.Invoke(Value4!); + value4?.Invoke(__value3); } } @@ -377,21 +377,21 @@ public void Switch( Validate(); } - if (IsValue1) + if (Value1 is { } __value0) { - value1?.Invoke(Value1!); + value1?.Invoke(__value0); } - else if (IsValue2) + else if (Value2 is { } __value1) { - value2?.Invoke(Value2!); + value2?.Invoke(__value1); } - else if (IsValue3) + else if (Value3 is { } __value2) { - value3?.Invoke(Value3!); + value3?.Invoke(__value2); } - else if (IsValue4) + else if (Value4 is { } __value3) { - value4?.Invoke(Value4!); + value4?.Invoke(__value3); } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AutoSDKHttpResponse.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AutoSDKHttpResponse.g.cs index 4620fca..0f77986 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AutoSDKHttpResponse.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.AutoSDKHttpResponse.g.cs @@ -164,9 +164,9 @@ public static class AutoSDKConditionalRequests { send = send ?? throw new global::System.ArgumentNullException(nameof(send)); requestOptions = CloneRequestOptions(requestOptions); - if (!string.IsNullOrWhiteSpace(entityTag)) + if (entityTag is { } nonEmptyEntityTag && !string.IsNullOrWhiteSpace(nonEmptyEntityTag)) { - requestOptions.Headers["If-None-Match"] = entityTag!; + requestOptions.Headers["If-None-Match"] = nonEmptyEntityTag; } try diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Answer.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Answer.g.cs index 1a7747b..a62789f 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Answer.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Answer.g.cs @@ -68,19 +68,19 @@ public override void Write( { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::TypeSafeAI.Generated.NoulAnswer), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::TypeSafeAI.Generated.NoulAnswer).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Noul!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickNoul(), typeInfo); } else if (value.IsScore) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::TypeSafeAI.Generated.ScoreAnswer), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::TypeSafeAI.Generated.ScoreAnswer).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Score!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickScore(), typeInfo); } else if (value.IsChoice) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::TypeSafeAI.Generated.ChoiceAnswer), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::TypeSafeAI.Generated.ChoiceAnswer).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Choice!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickChoice(), typeInfo); } } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf2.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf2.g.cs index ece494f..5577e83 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf2.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf2.g.cs @@ -148,13 +148,13 @@ public override void Write( { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue1(), typeInfo); } else if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue2(), typeInfo); } } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf3.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf3.g.cs index 8865978..4c8748b 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf3.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf3.g.cs @@ -197,19 +197,19 @@ public override void Write( { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue1(), typeInfo); } else if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue2(), typeInfo); } else if (value.IsValue3) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T3).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value3!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue3(), typeInfo); } } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf4.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf4.g.cs index e517ae3..9450707 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf4.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.AnyOf4.g.cs @@ -246,25 +246,25 @@ public override void Write( { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue1(), typeInfo); } else if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue2(), typeInfo); } else if (value.IsValue3) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T3).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value3!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue3(), typeInfo); } else if (value.IsValue4) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T4), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T4).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value4!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue4(), typeInfo); } } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Question.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Question.g.cs index f32aa1c..dedab25 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Question.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonConverters.Question.g.cs @@ -68,19 +68,19 @@ public override void Write( { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::TypeSafeAI.Generated.NoulQuestion), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::TypeSafeAI.Generated.NoulQuestion).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Noul!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickNoul(), typeInfo); } else if (value.IsChoice) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::TypeSafeAI.Generated.ChoiceQuestion), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::TypeSafeAI.Generated.ChoiceQuestion).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Choice!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickChoice(), typeInfo); } else if (value.IsScore) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::TypeSafeAI.Generated.ScoreQuestion), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::TypeSafeAI.Generated.ScoreQuestion).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Score!, typeInfo); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickScore(), typeInfo); } } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonSerializerContext.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonSerializerContext.g.cs index d00cca6..7b94a0b 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonSerializerContext.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.JsonSerializerContext.g.cs @@ -1,14 +1,12 @@ #nullable enable -#pragma warning disable CS0618 // Type or member is obsolete -#pragma warning disable CS3016 // Arrays as attribute arguments is not CLS-compliant - namespace TypeSafeAI.Generated { /// /// /// + #pragma warning disable CS3016 // Converter type array in this attribute is not CLS-compliant. [global::System.Text.Json.Serialization.JsonSourceGenerationOptions( DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, Converters = new global::System.Type[] @@ -47,6 +45,7 @@ namespace TypeSafeAI.Generated typeof(global::TypeSafeAI.Generated.JsonConverters.UnixTimestampJsonConverter), })] + #pragma warning restore CS3016 [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::TypeSafeAI.Generated.JsonSerializerContextTypes))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "SystemCollectionsGeneric_ObjectList")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::TypeSafeAI.Generated.Answer), TypeInfoPropertyName = "Answer2")] diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Answer.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Answer.g.cs index 72d142b..ad2c3d8 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Answer.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Answer.g.cs @@ -47,8 +47,8 @@ public bool TryPickNoul( /// /// /// - public global::TypeSafeAI.Generated.NoulAnswer PickNoul() => IsNoul - ? Noul! + public global::TypeSafeAI.Generated.NoulAnswer PickNoul() => Noul is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Noul' but the value was {ToString()}."); /// @@ -84,8 +84,8 @@ public bool TryPickScore( /// /// /// - public global::TypeSafeAI.Generated.ScoreAnswer PickScore() => IsScore - ? Score! + public global::TypeSafeAI.Generated.ScoreAnswer PickScore() => Score is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Score' but the value was {ToString()}."); /// @@ -121,8 +121,8 @@ public bool TryPickChoice( /// /// /// - public global::TypeSafeAI.Generated.ChoiceAnswer PickChoice() => IsChoice - ? Choice! + public global::TypeSafeAI.Generated.ChoiceAnswer PickChoice() => Choice is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Choice' but the value was {ToString()}."); /// /// @@ -250,17 +250,17 @@ public bool Validate() Validate(); } - if (IsNoul && noul != null) + if (Noul is { } __value0 && noul != null) { - return noul(Noul!); + return noul(__value0); } - else if (IsScore && score != null) + else if (Score is { } __value1 && score != null) { - return score(Score!); + return score(__value1); } - else if (IsChoice && choice != null) + else if (Choice is { } __value2 && choice != null) { - return choice(Choice!); + return choice(__value2); } return default(TResult); @@ -282,17 +282,17 @@ public void Match( Validate(); } - if (IsNoul) + if (Noul is { } __value0) { - noul?.Invoke(Noul!); + noul?.Invoke(__value0); } - else if (IsScore) + else if (Score is { } __value1) { - score?.Invoke(Score!); + score?.Invoke(__value1); } - else if (IsChoice) + else if (Choice is { } __value2) { - choice?.Invoke(Choice!); + choice?.Invoke(__value2); } } @@ -310,17 +310,17 @@ public void Switch( Validate(); } - if (IsNoul) + if (Noul is { } __value0) { - noul?.Invoke(Noul!); + noul?.Invoke(__value0); } - else if (IsScore) + else if (Score is { } __value1) { - score?.Invoke(Score!); + score?.Invoke(__value1); } - else if (IsChoice) + else if (Choice is { } __value2) { - choice?.Invoke(Choice!); + choice?.Invoke(__value2); } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Question.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Question.g.cs index 3cf4613..375f0d3 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Question.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.Models.Question.g.cs @@ -47,8 +47,8 @@ public bool TryPickNoul( /// /// /// - public global::TypeSafeAI.Generated.NoulQuestion PickNoul() => IsNoul - ? Noul! + public global::TypeSafeAI.Generated.NoulQuestion PickNoul() => Noul is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Noul' but the value was {ToString()}."); /// @@ -84,8 +84,8 @@ public bool TryPickChoice( /// /// /// - public global::TypeSafeAI.Generated.ChoiceQuestion PickChoice() => IsChoice - ? Choice! + public global::TypeSafeAI.Generated.ChoiceQuestion PickChoice() => Choice is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Choice' but the value was {ToString()}."); /// @@ -121,8 +121,8 @@ public bool TryPickScore( /// /// /// - public global::TypeSafeAI.Generated.ScoreQuestion PickScore() => IsScore - ? Score! + public global::TypeSafeAI.Generated.ScoreQuestion PickScore() => Score is { } value + ? value : throw new global::System.InvalidOperationException($"Expected union variant 'Score' but the value was {ToString()}."); /// /// @@ -250,17 +250,17 @@ public bool Validate() Validate(); } - if (IsNoul && noul != null) + if (Noul is { } __value0 && noul != null) { - return noul(Noul!); + return noul(__value0); } - else if (IsChoice && choice != null) + else if (Choice is { } __value1 && choice != null) { - return choice(Choice!); + return choice(__value1); } - else if (IsScore && score != null) + else if (Score is { } __value2 && score != null) { - return score(Score!); + return score(__value2); } return default(TResult); @@ -282,17 +282,17 @@ public void Match( Validate(); } - if (IsNoul) + if (Noul is { } __value0) { - noul?.Invoke(Noul!); + noul?.Invoke(__value0); } - else if (IsChoice) + else if (Choice is { } __value1) { - choice?.Invoke(Choice!); + choice?.Invoke(__value1); } - else if (IsScore) + else if (Score is { } __value2) { - score?.Invoke(Score!); + score?.Invoke(__value2); } } @@ -310,17 +310,17 @@ public void Switch( Validate(); } - if (IsNoul) + if (Noul is { } __value0) { - noul?.Invoke(Noul!); + noul?.Invoke(__value0); } - else if (IsChoice) + else if (Choice is { } __value1) { - choice?.Invoke(Choice!); + choice?.Invoke(__value1); } - else if (IsScore) + else if (Score is { } __value2) { - score?.Invoke(Score!); + score?.Invoke(__value2); } } diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.OptionsSupport.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.OptionsSupport.g.cs index b9cbe0c..d06acd4 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.OptionsSupport.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.OptionsSupport.g.cs @@ -241,7 +241,8 @@ public sealed class AutoSDKAuthorizationProviderHook : global::TypeSafeAI.Genera { context = context ?? throw new global::System.ArgumentNullException(nameof(context)); - if (context.Request == null) + var request = context.Request; + if (request == null) { return; } @@ -251,10 +252,10 @@ public sealed class AutoSDKAuthorizationProviderHook : global::TypeSafeAI.Genera { for (var index = 0; index < perRequest.Count; index++) { - ApplyAuthorization(context.Request, perRequest[index]); + ApplyAuthorization(request, perRequest[index]); } - global::TypeSafeAI.Generated.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request); + global::TypeSafeAI.Generated.AutoSDKHttpRequestOptions.StampAuthorizationOverride(request); return; } @@ -272,10 +273,10 @@ public sealed class AutoSDKAuthorizationProviderHook : global::TypeSafeAI.Genera for (var index = 0; index < resolved.Count; index++) { - ApplyAuthorization(context.Request, resolved[index]); + ApplyAuthorization(request, resolved[index]); } - global::TypeSafeAI.Generated.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request); + global::TypeSafeAI.Generated.AutoSDKHttpRequestOptions.StampAuthorizationOverride(request); } private static void ApplyAuthorization( @@ -486,7 +487,7 @@ public sealed class AutoSDKHookContext /// /// The outgoing HTTP request for the current attempt. /// - public global::System.Net.Http.HttpRequestMessage Request { get; set; } = null!; + public global::System.Net.Http.HttpRequestMessage? Request { get; set; } /// /// The HTTP response when one was received. @@ -501,7 +502,7 @@ public sealed class AutoSDKHookContext /// /// The client-wide runtime options. /// - public global::TypeSafeAI.Generated.AutoSDKClientOptions ClientOptions { get; set; } = null!; + public global::TypeSafeAI.Generated.AutoSDKClientOptions? ClientOptions { get; set; } /// /// The per-request runtime options. diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.ModelsV1V1ModelsGet.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.ModelsV1V1ModelsGet.g.cs index c30bd4b..a030e74 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.ModelsV1V1ModelsGet.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.ModelsV1V1ModelsGet.g.cs @@ -162,7 +162,7 @@ partial void ProcessModelsV1V1ModelsGetResponseContent( pathTemplate: "\"/v1/models\"", httpMethod: "GET", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: null, exception: null, clientOptions: Options, @@ -196,7 +196,7 @@ partial void ProcessModelsV1V1ModelsGetResponseContent( pathTemplate: "\"/v1/models\"", httpMethod: "GET", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: null, exception: __exception, clientOptions: Options, @@ -237,7 +237,7 @@ partial void ProcessModelsV1V1ModelsGetResponseContent( pathTemplate: "\"/v1/models\"", httpMethod: "GET", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: __response, exception: null, clientOptions: Options, @@ -285,7 +285,7 @@ partial void ProcessModelsV1V1ModelsGetResponseContent( pathTemplate: "\"/v1/models\"", httpMethod: "GET", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: __response, exception: null, clientOptions: Options, @@ -307,7 +307,7 @@ partial void ProcessModelsV1V1ModelsGetResponseContent( pathTemplate: "\"/v1/models\"", httpMethod: "GET", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: __response, exception: null, clientOptions: Options, diff --git a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.SystemoneV1SystemonePost.g.cs b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.SystemoneV1SystemonePost.g.cs index 38d32ef..899826f 100644 --- a/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.SystemoneV1SystemonePost.g.cs +++ b/src/libs/TypeSafeAI/Generated/TypeSafeAI.Generated.RawTypeSafeClient.SystemoneV1SystemonePost.g.cs @@ -186,7 +186,7 @@ partial void ProcessSystemoneV1SystemonePostResponseContent( pathTemplate: "\"/v1/systemone\"", httpMethod: "POST", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: null, exception: null, clientOptions: Options, @@ -220,7 +220,7 @@ partial void ProcessSystemoneV1SystemonePostResponseContent( pathTemplate: "\"/v1/systemone\"", httpMethod: "POST", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: null, exception: __exception, clientOptions: Options, @@ -261,7 +261,7 @@ partial void ProcessSystemoneV1SystemonePostResponseContent( pathTemplate: "\"/v1/systemone\"", httpMethod: "POST", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: __response, exception: null, clientOptions: Options, @@ -309,7 +309,7 @@ partial void ProcessSystemoneV1SystemonePostResponseContent( pathTemplate: "\"/v1/systemone\"", httpMethod: "POST", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: __response, exception: null, clientOptions: Options, @@ -331,7 +331,7 @@ partial void ProcessSystemoneV1SystemonePostResponseContent( pathTemplate: "\"/v1/systemone\"", httpMethod: "POST", baseUri: BaseUri, - request: __httpRequest!, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), response: __response, exception: null, clientOptions: Options,