From ff2841e5b8f569b2bdf63e4a7d95bc366f9e955f Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Tue, 10 Oct 2023 10:21:45 -0700 Subject: [PATCH] chore: Remove explicit caller argument info on ThrowIfNull. --- src/lib/Helpers/ValidationHelpers.cs | 5 ----- src/lib/OpenAI/OpenAIPluginManifest.cs | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/Helpers/ValidationHelpers.cs b/src/lib/Helpers/ValidationHelpers.cs index 0299c9a..0e193dc 100644 --- a/src/lib/Helpers/ValidationHelpers.cs +++ b/src/lib/Helpers/ValidationHelpers.cs @@ -10,11 +10,6 @@ internal static void ValidateNullOrWhitespace(string parameterName, string? valu throw new ArgumentNullException(parameterName, string.Format(ErrorMessage.FieldIsRequired, parameterName, parentName)); } - internal static void ValidateNullObject(string parameterName, object? value) - { - ArgumentNullException.ThrowIfNull(value, parameterName); - } - internal static void ValidateLength(string parameterName, string? value, int maxLength) { if (value?.Length > maxLength) diff --git a/src/lib/OpenAI/OpenAIPluginManifest.cs b/src/lib/OpenAI/OpenAIPluginManifest.cs index ac586e5..7ab27c7 100644 --- a/src/lib/OpenAI/OpenAIPluginManifest.cs +++ b/src/lib/OpenAI/OpenAIPluginManifest.cs @@ -137,8 +137,8 @@ private void Validate(OpenAIPluginManifest openAIPluginManifest) ValidationHelpers.ValidateLength(nameof(DescriptionForModel), openAIPluginManifest.DescriptionForModel, 8000); ValidationHelpers.ValidateNullOrWhitespace(nameof(SchemaVersion), openAIPluginManifest.SchemaVersion, nameof(OpenAIPluginManifest)); - ValidationHelpers.ValidateNullObject(nameof(Auth), openAIPluginManifest.Auth); - ValidationHelpers.ValidateNullObject(nameof(Api), openAIPluginManifest.Api); + ArgumentNullException.ThrowIfNull(openAIPluginManifest.Auth); + ArgumentNullException.ThrowIfNull(openAIPluginManifest.Api); ValidationHelpers.ValidateNullOrWhitespace(nameof(LogoUrl), openAIPluginManifest.LogoUrl, nameof(OpenAIPluginManifest)); ValidationHelpers.ValidateEmail(nameof(ContactEmail), openAIPluginManifest.ContactEmail, nameof(OpenAIPluginManifest)); ValidationHelpers.ValidateNullOrWhitespace(nameof(LegalInfoUrl), openAIPluginManifest.LegalInfoUrl, nameof(OpenAIPluginManifest));