From 56b3ce84b4a2d909b3237242e6260389aa1cf956 Mon Sep 17 00:00:00 2001 From: Maksym Sadovnychyy Date: Fri, 25 Jul 2025 18:55:31 +0200 Subject: [PATCH] (feature): less strict default patch operation model validation --- .../Abstractions/Webapi/PatchRequestModelBase.cs | 9 --------- src/MaksIT.Core/MaksIT.Core.csproj | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs b/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs index 9f95b23..5296145 100644 --- a/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs +++ b/src/MaksIT.Core/Abstractions/Webapi/PatchRequestModelBase.cs @@ -11,11 +11,6 @@ public abstract class PatchRequestModelBase : RequestModelBase { public Dictionary? Operations { get; set; } - private bool HasNonNullPatchField => GetType() - .GetProperties(BindingFlags.Public | BindingFlags.Instance) - .Where(prop => prop.Name != nameof(Operations)) - .Any(prop => prop.GetValue(this) != null); - /// /// Attempts to retrieve the patch operation associated with the specified property name (case insensitive). /// @@ -40,10 +35,6 @@ public abstract class PatchRequestModelBase : RequestModelBase { } public override IEnumerable Validate(ValidationContext validationContext) { - if (!HasNonNullPatchField) { - yield return new ValidationResult("At least one patch field must be provided", ["PatchField"]); - } - if (Operations != null) { foreach (var operation in Operations) { if (!Enum.IsDefined(typeof(PatchOperation), operation.Value)) { diff --git a/src/MaksIT.Core/MaksIT.Core.csproj b/src/MaksIT.Core/MaksIT.Core.csproj index 390eede..2dbbb13 100644 --- a/src/MaksIT.Core/MaksIT.Core.csproj +++ b/src/MaksIT.Core/MaksIT.Core.csproj @@ -8,7 +8,7 @@ MaksIT.Core - 1.4.3 + 1.4.4 Maksym Sadovnychyy MAKS-IT MaksIT.Core