From aa6a4e2c7dbcd5a2cd4a9bc513e8479d98e0a1c9 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Sat, 1 Jun 2024 17:03:46 +0400 Subject: [PATCH] fix: Fixed bug with AnyOf/OneOf in parameters. --- src/libs/Directory.Build.props | 2 +- .../OpenApiGenerator.Core/Models/TypeData.cs | 8 +-- ...G.Models.CreateModelResponse.g.verified.cs | 2 +- ..._#G.Models.PullModelResponse.g.verified.cs | 2 +- ..._#G.Models.PushModelResponse.g.verified.cs | 2 +- ...G.Models.CreateModelResponse.g.verified.cs | 2 +- ..._#G.Models.PullModelResponse.g.verified.cs | 2 +- ..._#G.Models.PushModelResponse.g.verified.cs | 2 +- ..._#JsonSerializerContextTypes.g.verified.cs | 6 +- ...stantsClient.CreateAssistant.g.verified.cs | 2 +- ...G.AssistantsClient.CreateRun.g.verified.cs | 4 +- ...ntsClient.CreateThreadAndRun.g.verified.cs | 4 +- ...stantsClient.ModifyAssistant.g.verified.cs | 2 +- ...tClient.CreateChatCompletion.g.verified.cs | 2 +- .../_#G.Models.AssistantObject.g.verified.cs | 2 +- ...odels.CreateAssistantRequest.g.verified.cs | 2 +- ....CreateChatCompletionRequest.g.verified.cs | 2 +- .../_#G.Models.CreateRunRequest.g.verified.cs | 4 +- ...ls.CreateThreadAndRunRequest.g.verified.cs | 4 +- ...odels.ModifyAssistantRequest.g.verified.cs | 2 +- .../_#G.Models.RunObject.g.verified.cs | 4 +- ...stantsClient.CreateAssistant.g.verified.cs | 2 +- ...G.AssistantsClient.CreateRun.g.verified.cs | 4 +- ...ntsClient.CreateThreadAndRun.g.verified.cs | 4 +- ...stantsClient.ModifyAssistant.g.verified.cs | 2 +- ...tClient.CreateChatCompletion.g.verified.cs | 2 +- .../_#G.Models.AssistantObject.g.verified.cs | 2 +- ...odels.CreateAssistantRequest.g.verified.cs | 2 +- ....CreateChatCompletionRequest.g.verified.cs | 2 +- .../_#G.Models.CreateRunRequest.g.verified.cs | 4 +- ...ls.CreateThreadAndRunRequest.g.verified.cs | 4 +- ...odels.ModifyAssistantRequest.g.verified.cs | 2 +- .../_#G.Models.RunObject.g.verified.cs | 4 +- .../Snapshots/Ollama/Models/_.verified.txt | 18 +++--- .../Snapshots/Ollama/Types/_.verified.txt | 18 +++--- .../Snapshots/OpenAi/Methods/_.verified.txt | 42 ++++++------- .../Snapshots/OpenAi/Models/_.verified.txt | 60 +++++++++---------- 37 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/libs/Directory.Build.props b/src/libs/Directory.Build.props index ad50395f23..f7986b87bb 100644 --- a/src/libs/Directory.Build.props +++ b/src/libs/Directory.Build.props @@ -39,7 +39,7 @@ - 0.9.6 + 0.9.7 0.1 v dev diff --git a/src/libs/OpenApiGenerator.Core/Models/TypeData.cs b/src/libs/OpenApiGenerator.Core/Models/TypeData.cs index 81c352007b..a4705bb702 100644 --- a/src/libs/OpenApiGenerator.Core/Models/TypeData.cs +++ b/src/libs/OpenApiGenerator.Core/Models/TypeData.cs @@ -96,6 +96,10 @@ public static string GetCSharpType( var model = ModelData.FromSchema(schema, settings, parents); var (type, reference) = (schema.Value.Type, schema.Value.Format) switch { + (null, _) when schema.Value.AnyOf.Any() => ($"global::System.AnyOf<{string.Join(", ", schema.Value.AnyOf.Select(x => GetCSharpType(x.WithKey(schema.Key), settings, parents)))}>", false), + (null, _) when schema.Value.OneOf.Any() => ($"global::System.OneOf<{string.Join(", ", schema.Value.OneOf.Select(x => GetCSharpType(x.WithKey(schema.Key), settings, parents)))}>", false), + (null, _) when schema.Value.AllOf.Any() => ($"global::System.AllOf<{string.Join(", ", schema.Value.AllOf.Select(x => GetCSharpType(x.WithKey(schema.Key), settings, parents)))}>", false), + ("object", _) or (null, _) when schema.Value.Reference != null => ($"{ModelData.FromKey(schema.Value.Reference.Id, settings).ClassName}", true), ("object", _) when schema.Value.Reference == null && @@ -104,10 +108,6 @@ public static string GetCSharpType( ("object", _) when schema.Value.Reference == null => ($"{model.ExternalClassName}", true), - (null, _) when schema.Value.AnyOf.Any() => ($"global::System.AnyOf<{string.Join(", ", schema.Value.AnyOf.Select(x => GetCSharpType(x.WithKey(schema.Key), settings, parents)))}>", false), - (null, _) when schema.Value.OneOf.Any() => ($"global::System.OneOf<{string.Join(", ", schema.Value.OneOf.Select(x => GetCSharpType(x.WithKey(schema.Key), settings, parents)))}>", false), - (null, _) when schema.Value.AllOf.Any() => ($"global::System.AllOf<{string.Join(", ", schema.Value.AllOf.Select(x => GetCSharpType(x.WithKey(schema.Key), settings, parents)))}>", false), - ("string", _) when schema.Value.Enum.Any() => ($"{(model with { Style = ModelStyle.Enumeration }).ExternalClassName}", true), // ("string", _) when schema.Value.Enum.Any() && settings.JsonSerializerType != JsonSerializerType.NewtonsoftJson => diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.CreateModelResponse.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.CreateModelResponse.g.verified.cs index ad057ac65f..46bd5d4a6c 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.CreateModelResponse.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.CreateModelResponse.g.verified.cs @@ -13,7 +13,7 @@ public sealed partial class CreateModelResponse /// Status creating the model /// [global::Newtonsoft.Json.JsonProperty("status")] - public CreateModelStatus? Status { get; set; } + public global::System.AnyOf Status { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PullModelResponse.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PullModelResponse.g.verified.cs index 77ae2f5402..42f40ebe00 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PullModelResponse.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PullModelResponse.g.verified.cs @@ -16,7 +16,7 @@ public sealed partial class PullModelResponse ///
Example: pulling manifest ///
[global::Newtonsoft.Json.JsonProperty("status")] - public PullModelStatus? Status { get; set; } + public global::System.AnyOf Status { get; set; } /// /// The model's digest. diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PushModelResponse.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PushModelResponse.g.verified.cs index 399e257b2a..2e9f1eadb5 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PushModelResponse.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/NewtonsoftJson/_#G.Models.PushModelResponse.g.verified.cs @@ -13,7 +13,7 @@ public sealed partial class PushModelResponse /// Status pushing the model. /// [global::Newtonsoft.Json.JsonProperty("status")] - public PushModelStatus? Status { get; set; } + public global::System.AnyOf Status { get; set; } /// /// the model's digest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.CreateModelResponse.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.CreateModelResponse.g.verified.cs index 26fdf17d8c..1f110089da 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.CreateModelResponse.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.CreateModelResponse.g.verified.cs @@ -14,7 +14,7 @@ public sealed partial class CreateModelResponse /// [global::System.Text.Json.Serialization.JsonPropertyName("status")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2))] - public CreateModelStatus? Status { get; set; } + public global::System.AnyOf Status { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PullModelResponse.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PullModelResponse.g.verified.cs index c9e287381d..b333698f69 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PullModelResponse.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PullModelResponse.g.verified.cs @@ -17,7 +17,7 @@ public sealed partial class PullModelResponse /// [global::System.Text.Json.Serialization.JsonPropertyName("status")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2))] - public PullModelStatus? Status { get; set; } + public global::System.AnyOf Status { get; set; } /// /// The model's digest. diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PushModelResponse.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PushModelResponse.g.verified.cs index c1f8ad6690..a9525939e3 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PushModelResponse.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#G.Models.PushModelResponse.g.verified.cs @@ -14,7 +14,7 @@ public sealed partial class PushModelResponse /// [global::System.Text.Json.Serialization.JsonPropertyName("status")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2))] - public PushModelStatus? Status { get; set; } + public global::System.AnyOf Status { get; set; } /// /// the model's digest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs index 13aaf26e5d..1a6577ea6d 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/Ollama/SystemTextJson/_#JsonSerializerContextTypes.g.verified.cs @@ -72,7 +72,7 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public CreateModelStatus? Type15 { get; set; } + public global::System.AnyOf? Type15 { get; set; } /// /// /// @@ -84,11 +84,11 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public PullModelStatus? Type18 { get; set; } + public global::System.AnyOf? Type18 { get; set; } /// /// /// - public PushModelStatus? Type19 { get; set; } + public global::System.AnyOf? Type19 { get; set; } /// /// /// diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs index 50ca88d5cb..6d2d947d7f 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs @@ -64,7 +64,7 @@ public partial class AssistantsClient object? metadata = default, double? temperature = 1, double? topP = 1, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new CreateAssistantRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateRun.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateRun.g.verified.cs index bf161e90fe..d55ed942bd 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateRun.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateRun.g.verified.cs @@ -77,8 +77,8 @@ public partial class AssistantsClient int? maxPromptTokens = default, int? maxCompletionTokens = default, TruncationObject? truncationStrategy = default, - AssistantsApiToolChoiceOption? toolChoice = default, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf toolChoice = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new CreateRunRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs index 9a8044b987..499d88d3fa 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs @@ -73,8 +73,8 @@ public partial class AssistantsClient int? maxPromptTokens = default, int? maxCompletionTokens = default, TruncationObject? truncationStrategy = default, - AssistantsApiToolChoiceOption? toolChoice = default, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf toolChoice = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new CreateThreadAndRunRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs index 28717efc36..0f1fa21371 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs @@ -68,7 +68,7 @@ public partial class AssistantsClient object? metadata = default, double? temperature = 1, double? topP = 1, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new ModifyAssistantRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs index f8f17e2c7d..24069ef6fa 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs @@ -83,7 +83,7 @@ public partial class ChatClient double? temperature = 1, double? topP = 1, global::System.Collections.Generic.IList? tools = default, - ChatCompletionToolChoiceOption? toolChoice = default, + global::System.OneOf toolChoice = default, string? user = default, global::System.OneOf functionCall = default, global::System.Collections.Generic.IList? functions = default, diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.AssistantObject.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.AssistantObject.g.verified.cs index 5b9129a3d2..9da60cf2eb 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.AssistantObject.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.AssistantObject.g.verified.cs @@ -93,7 +93,7 @@ public sealed partial class AssistantObject /// **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. /// [global::Newtonsoft.Json.JsonProperty("response_format")] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateAssistantRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateAssistantRequest.g.verified.cs index 875fdbbc9d..bcdd22292d 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateAssistantRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateAssistantRequest.g.verified.cs @@ -76,7 +76,7 @@ public sealed partial class CreateAssistantRequest /// **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. /// [global::Newtonsoft.Json.JsonProperty("response_format")] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs index 0a487f0d8c..9e40bda5d0 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs @@ -144,7 +144,7 @@ public sealed partial class CreateChatCompletionRequest /// `none` is the default when no tools are present. `auto` is the default if tools are present. /// [global::Newtonsoft.Json.JsonProperty("tool_choice")] - public ChatCompletionToolChoiceOption? ToolChoice { get; set; } + public global::System.OneOf ToolChoice { get; set; } /// /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateRunRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateRunRequest.g.verified.cs index b9dd486af9..360a453e8e 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateRunRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateRunRequest.g.verified.cs @@ -101,7 +101,7 @@ public sealed partial class CreateRunRequest /// Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. /// [global::Newtonsoft.Json.JsonProperty("tool_choice")] - public AssistantsApiToolChoiceOption? ToolChoice { get; set; } + public global::System.OneOf ToolChoice { get; set; } /// /// Specifies the format that the model must output. Compatible with [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. @@ -109,7 +109,7 @@ public sealed partial class CreateRunRequest /// **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. /// [global::Newtonsoft.Json.JsonProperty("response_format")] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs index cd0bbc1a7c..e92a0f9cb2 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs @@ -101,7 +101,7 @@ public sealed partial class CreateThreadAndRunRequest /// Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. /// [global::Newtonsoft.Json.JsonProperty("tool_choice")] - public AssistantsApiToolChoiceOption? ToolChoice { get; set; } + public global::System.OneOf ToolChoice { get; set; } /// /// Specifies the format that the model must output. Compatible with [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. @@ -109,7 +109,7 @@ public sealed partial class CreateThreadAndRunRequest /// **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. /// [global::Newtonsoft.Json.JsonProperty("response_format")] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.ModifyAssistantRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.ModifyAssistantRequest.g.verified.cs index b7f1cdb56e..b45a42b034 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.ModifyAssistantRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.ModifyAssistantRequest.g.verified.cs @@ -75,7 +75,7 @@ public sealed partial class ModifyAssistantRequest /// **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. /// [global::Newtonsoft.Json.JsonProperty("response_format")] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.RunObject.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.RunObject.g.verified.cs index 77dd5ec9e6..630c166f71 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.RunObject.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/NewtonsoftJson/_#G.Models.RunObject.g.verified.cs @@ -162,7 +162,7 @@ public sealed partial class RunObject /// Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. /// [global::Newtonsoft.Json.JsonProperty("tool_choice", Required = global::Newtonsoft.Json.Required.Always)] - public AssistantsApiToolChoiceOption ToolChoice { get; set; } = default!; + public global::System.OneOf ToolChoice { get; set; } = default!; /// /// Specifies the format that the model must output. Compatible with [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. @@ -170,7 +170,7 @@ public sealed partial class RunObject /// **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. /// [global::Newtonsoft.Json.JsonProperty("response_format", Required = global::Newtonsoft.Json.Required.Always)] - public AssistantsApiResponseFormatOption ResponseFormat { get; set; } = default!; + public global::System.OneOf ResponseFormat { get; set; } = default!; /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs index 02b2290c3d..72880b7afc 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateAssistant.g.verified.cs @@ -64,7 +64,7 @@ public partial class AssistantsClient object? metadata = default, double? temperature = 1, double? topP = 1, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new CreateAssistantRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateRun.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateRun.g.verified.cs index baaaf11dca..e7d97a0af4 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateRun.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateRun.g.verified.cs @@ -77,8 +77,8 @@ public partial class AssistantsClient int? maxPromptTokens = default, int? maxCompletionTokens = default, TruncationObject? truncationStrategy = default, - AssistantsApiToolChoiceOption? toolChoice = default, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf toolChoice = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new CreateRunRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs index 9408bd4449..15ad0786dd 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.CreateThreadAndRun.g.verified.cs @@ -73,8 +73,8 @@ public partial class AssistantsClient int? maxPromptTokens = default, int? maxCompletionTokens = default, TruncationObject? truncationStrategy = default, - AssistantsApiToolChoiceOption? toolChoice = default, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf toolChoice = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new CreateThreadAndRunRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs index db70cb6c85..3913c4a689 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.AssistantsClient.ModifyAssistant.g.verified.cs @@ -68,7 +68,7 @@ public partial class AssistantsClient object? metadata = default, double? temperature = 1, double? topP = 1, - AssistantsApiResponseFormatOption? responseFormat = default, + global::System.OneOf responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { var request = new ModifyAssistantRequest diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs index ef0b8d64a6..3958546949 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.ChatClient.CreateChatCompletion.g.verified.cs @@ -83,7 +83,7 @@ public partial class ChatClient double? temperature = 1, double? topP = 1, global::System.Collections.Generic.IList? tools = default, - ChatCompletionToolChoiceOption? toolChoice = default, + global::System.OneOf toolChoice = default, string? user = default, global::System.OneOf functionCall = default, global::System.Collections.Generic.IList? functions = default, diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.AssistantObject.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.AssistantObject.g.verified.cs index 53d0330269..0ea1551276 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.AssistantObject.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.AssistantObject.g.verified.cs @@ -104,7 +104,7 @@ public sealed partial class AssistantObject /// [global::System.Text.Json.Serialization.JsonPropertyName("response_format")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateAssistantRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateAssistantRequest.g.verified.cs index d9ca919590..3f0acabe59 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateAssistantRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateAssistantRequest.g.verified.cs @@ -79,7 +79,7 @@ public sealed partial class CreateAssistantRequest /// [global::System.Text.Json.Serialization.JsonPropertyName("response_format")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs index 1e8a261f3f..51a89c0e2c 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateChatCompletionRequest.g.verified.cs @@ -149,7 +149,7 @@ public sealed partial class CreateChatCompletionRequest /// [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public ChatCompletionToolChoiceOption? ToolChoice { get; set; } + public global::System.OneOf ToolChoice { get; set; } /// /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateRunRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateRunRequest.g.verified.cs index 3996df6f0e..e008c06b74 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateRunRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateRunRequest.g.verified.cs @@ -104,7 +104,7 @@ public sealed partial class CreateRunRequest /// [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public AssistantsApiToolChoiceOption? ToolChoice { get; set; } + public global::System.OneOf ToolChoice { get; set; } /// /// Specifies the format that the model must output. Compatible with [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. @@ -113,7 +113,7 @@ public sealed partial class CreateRunRequest /// [global::System.Text.Json.Serialization.JsonPropertyName("response_format")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs index 0cf64fcd95..1ef5472f6c 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.CreateThreadAndRunRequest.g.verified.cs @@ -104,7 +104,7 @@ public sealed partial class CreateThreadAndRunRequest /// [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public AssistantsApiToolChoiceOption? ToolChoice { get; set; } + public global::System.OneOf ToolChoice { get; set; } /// /// Specifies the format that the model must output. Compatible with [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. @@ -113,7 +113,7 @@ public sealed partial class CreateThreadAndRunRequest /// [global::System.Text.Json.Serialization.JsonPropertyName("response_format")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.ModifyAssistantRequest.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.ModifyAssistantRequest.g.verified.cs index 159988b53f..ed5a2a7fa8 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.ModifyAssistantRequest.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.ModifyAssistantRequest.g.verified.cs @@ -77,7 +77,7 @@ public sealed partial class ModifyAssistantRequest /// [global::System.Text.Json.Serialization.JsonPropertyName("response_format")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] - public AssistantsApiResponseFormatOption? ResponseFormat { get; set; } + public global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.RunObject.g.verified.cs b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.RunObject.g.verified.cs index ccffc19d5f..e490b9b5e4 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.RunObject.g.verified.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Snapshots/OpenAi/SystemTextJson/_#G.Models.RunObject.g.verified.cs @@ -188,7 +188,7 @@ public sealed partial class RunObject [global::System.Text.Json.Serialization.JsonPropertyName("tool_choice")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] [global::System.Text.Json.Serialization.JsonRequired] - public required AssistantsApiToolChoiceOption ToolChoice { get; set; } + public required global::System.OneOf ToolChoice { get; set; } /// /// Specifies the format that the model must output. Compatible with [GPT-4 Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. @@ -198,7 +198,7 @@ public sealed partial class RunObject [global::System.Text.Json.Serialization.JsonPropertyName("response_format")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.OneOfJsonConverterFactory2))] [global::System.Text.Json.Serialization.JsonRequired] - public required AssistantsApiResponseFormatOption ResponseFormat { get; set; } + public required global::System.OneOf ResponseFormat { get; set; } /// /// Additional properties that are not explicitly defined in the schema diff --git a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Models/_.verified.txt b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Models/_.verified.txt index 52a28c6b8a..26d8a7dc03 100644 --- a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Models/_.verified.txt +++ b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Models/_.verified.txt @@ -2562,7 +2562,7 @@ If `false` the response will be returned as a single response object, otherwise Id: status, Name: Status, Type: { - CSharpType: CreateModelStatus?, + CSharpType: global::System.AnyOf, IsArray: false, IsEnum: false, AnyOfCount: 2, @@ -2570,8 +2570,8 @@ If `false` the response will be returned as a single response object, otherwise EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: true, - CSharpTypeWithoutNullability: CreateModelStatus, - CSharpTypeWithNullability: CreateModelStatus?, + CSharpTypeWithoutNullability: global::System.AnyOf, + CSharpTypeWithNullability: global::System.AnyOf?, ConverterType: AnyOfJsonConverterFactory2 }, IsRequired: false, @@ -3559,7 +3559,7 @@ If `false` the response will be returned as a single response object, otherwise Id: status, Name: Status, Type: { - CSharpType: PullModelStatus?, + CSharpType: global::System.AnyOf, IsArray: false, IsEnum: false, AnyOfCount: 2, @@ -3567,8 +3567,8 @@ If `false` the response will be returned as a single response object, otherwise EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: true, - CSharpTypeWithoutNullability: PullModelStatus, - CSharpTypeWithNullability: PullModelStatus?, + CSharpTypeWithoutNullability: global::System.AnyOf, + CSharpTypeWithNullability: global::System.AnyOf?, ConverterType: AnyOfJsonConverterFactory2 }, IsRequired: false, @@ -4005,7 +4005,7 @@ If `false` the response will be returned as a single response object, otherwise Id: status, Name: Status, Type: { - CSharpType: PushModelStatus?, + CSharpType: global::System.AnyOf, IsArray: false, IsEnum: false, AnyOfCount: 2, @@ -4013,8 +4013,8 @@ If `false` the response will be returned as a single response object, otherwise EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: true, - CSharpTypeWithoutNullability: PushModelStatus, - CSharpTypeWithNullability: PushModelStatus?, + CSharpTypeWithoutNullability: global::System.AnyOf, + CSharpTypeWithNullability: global::System.AnyOf?, ConverterType: AnyOfJsonConverterFactory2 }, IsRequired: false, diff --git a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Types/_.verified.txt b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Types/_.verified.txt index 4559b53f9f..b5398e3477 100644 --- a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Types/_.verified.txt +++ b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Ollama/Types/_.verified.txt @@ -231,7 +231,7 @@ ConverterType: }, { - CSharpType: CreateModelStatus?, + CSharpType: global::System.AnyOf, IsArray: false, IsEnum: false, AnyOfCount: 2, @@ -239,8 +239,8 @@ EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: true, - CSharpTypeWithoutNullability: CreateModelStatus, - CSharpTypeWithNullability: CreateModelStatus?, + CSharpTypeWithoutNullability: global::System.AnyOf, + CSharpTypeWithNullability: global::System.AnyOf?, ConverterType: AnyOfJsonConverterFactory2 }, { @@ -275,7 +275,7 @@ ConverterType: }, { - CSharpType: PullModelStatus?, + CSharpType: global::System.AnyOf, IsArray: false, IsEnum: false, AnyOfCount: 2, @@ -283,12 +283,12 @@ EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: true, - CSharpTypeWithoutNullability: PullModelStatus, - CSharpTypeWithNullability: PullModelStatus?, + CSharpTypeWithoutNullability: global::System.AnyOf, + CSharpTypeWithNullability: global::System.AnyOf?, ConverterType: AnyOfJsonConverterFactory2 }, { - CSharpType: PushModelStatus?, + CSharpType: global::System.AnyOf, IsArray: false, IsEnum: false, AnyOfCount: 2, @@ -296,8 +296,8 @@ EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: true, - CSharpTypeWithoutNullability: PushModelStatus, - CSharpTypeWithNullability: PushModelStatus?, + CSharpTypeWithoutNullability: global::System.AnyOf, + CSharpTypeWithNullability: global::System.AnyOf?, ConverterType: AnyOfJsonConverterFactory2 }, { diff --git a/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Methods/_.verified.txt b/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Methods/_.verified.txt index e0f1632513..56c66f9ab9 100644 --- a/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Methods/_.verified.txt +++ b/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Methods/_.verified.txt @@ -474,7 +474,7 @@ A list of tools the model may call. Currently, only functions are supported as a Id: tool_choice, Name: ToolChoice, Type: { - CSharpType: ChatCompletionToolChoiceOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -482,8 +482,8 @@ A list of tools the model may call. Currently, only functions are supported as a EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: ChatCompletionToolChoiceOption, - CSharpTypeWithNullability: ChatCompletionToolChoiceOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -5483,7 +5483,7 @@ We generally recommend altering this or temperature but not both. Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -5491,8 +5491,8 @@ We generally recommend altering this or temperature but not both. EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -6005,7 +6005,7 @@ We generally recommend altering this or temperature but not both. Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -6013,8 +6013,8 @@ We generally recommend altering this or temperature but not both. EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -8000,7 +8000,7 @@ The maximum number of completion tokens that may be used over the course of the Id: tool_choice, Name: ToolChoice, Type: { - CSharpType: AssistantsApiToolChoiceOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -8008,8 +8008,8 @@ The maximum number of completion tokens that may be used over the course of the EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiToolChoiceOption, - CSharpTypeWithNullability: AssistantsApiToolChoiceOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -8030,7 +8030,7 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -8038,8 +8038,8 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -8775,7 +8775,7 @@ The maximum number of completion tokens that may be used over the course of the Id: tool_choice, Name: ToolChoice, Type: { - CSharpType: AssistantsApiToolChoiceOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -8783,8 +8783,8 @@ The maximum number of completion tokens that may be used over the course of the EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiToolChoiceOption, - CSharpTypeWithNullability: AssistantsApiToolChoiceOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -8805,7 +8805,7 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -8813,8 +8813,8 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, diff --git a/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Models/_.verified.txt b/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Models/_.verified.txt index 2ad9b69691..d470aa97c7 100644 --- a/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Models/_.verified.txt +++ b/src/tests/OpenApiGenerator.UnitTests/Snapshots/OpenAi/Models/_.verified.txt @@ -4749,7 +4749,7 @@ A list of tools the model may call. Currently, only functions are supported as a Id: tool_choice, Name: ToolChoice, Type: { - CSharpType: ChatCompletionToolChoiceOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -4757,8 +4757,8 @@ A list of tools the model may call. Currently, only functions are supported as a EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: ChatCompletionToolChoiceOption, - CSharpTypeWithNullability: ChatCompletionToolChoiceOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -17146,7 +17146,7 @@ We generally recommend altering this or temperature but not both. Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -17154,8 +17154,8 @@ We generally recommend altering this or temperature but not both. EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -17695,7 +17695,7 @@ We generally recommend altering this or temperature but not both. Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -17703,8 +17703,8 @@ We generally recommend altering this or temperature but not both. EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -18729,7 +18729,7 @@ We generally recommend altering this or temperature but not both. Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -18737,8 +18737,8 @@ We generally recommend altering this or temperature but not both. EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -20506,7 +20506,7 @@ The maximum number of completion tokens specified to have been used over the cou Id: tool_choice, Name: ToolChoice, Type: { - CSharpType: AssistantsApiToolChoiceOption, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -20514,8 +20514,8 @@ The maximum number of completion tokens specified to have been used over the cou EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiToolChoiceOption, - CSharpTypeWithNullability: AssistantsApiToolChoiceOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: true, @@ -20536,7 +20536,7 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -20544,8 +20544,8 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: true, @@ -21735,7 +21735,7 @@ The maximum number of completion tokens that may be used over the course of the Id: tool_choice, Name: ToolChoice, Type: { - CSharpType: AssistantsApiToolChoiceOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -21743,8 +21743,8 @@ The maximum number of completion tokens that may be used over the course of the EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiToolChoiceOption, - CSharpTypeWithNullability: AssistantsApiToolChoiceOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -21765,7 +21765,7 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -21773,8 +21773,8 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -23243,7 +23243,7 @@ The maximum number of completion tokens that may be used over the course of the Id: tool_choice, Name: ToolChoice, Type: { - CSharpType: AssistantsApiToolChoiceOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -23251,8 +23251,8 @@ The maximum number of completion tokens that may be used over the course of the EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiToolChoiceOption, - CSharpTypeWithNullability: AssistantsApiToolChoiceOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false, @@ -23273,7 +23273,7 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi Id: response_format, Name: ResponseFormat, Type: { - CSharpType: AssistantsApiResponseFormatOption?, + CSharpType: global::System.OneOf, IsArray: false, IsEnum: false, OneOfCount: 2, @@ -23281,8 +23281,8 @@ Specifying a particular tool like `{"type": "file_search"}` or `{"type": "functi EnumValues: null, Namespace: G, GenerateJsonSerializerContextTypes: false, - CSharpTypeWithoutNullability: AssistantsApiResponseFormatOption, - CSharpTypeWithNullability: AssistantsApiResponseFormatOption?, + CSharpTypeWithoutNullability: global::System.OneOf, + CSharpTypeWithNullability: global::System.OneOf?, ConverterType: OneOfJsonConverterFactory2 }, IsRequired: false,