namespace Novelly.Api.Common.Validation; public static class ValidationResultExtensions { /// /// The service-level half of "validate again and throw if invalid": callers that reach /// a service directly (agent tools, MCP, tests) skip the API's , /// so services re-run the same validator and throw rather than act on bad data. /// public static void ThrowIfInvalid(this ValidationResult result) { if (result.IsInvalid) { throw new ArgumentException(string.Join("; ", result.Errors.Select(e => $"{e.PropertyName}: {e.Message}"))); } } }