using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using StellaOps.Vexer.Connectors.Abstractions; namespace StellaOps.Vexer.Connectors.Cisco.CSAF.Configuration; public sealed class CiscoConnectorOptionsValidator : IVexConnectorOptionsValidator { public void Validate(VexConnectorDescriptor descriptor, CiscoConnectorOptions options, IList errors) { ArgumentNullException.ThrowIfNull(descriptor); ArgumentNullException.ThrowIfNull(options); ArgumentNullException.ThrowIfNull(errors); var validationResults = new List(); if (!Validator.TryValidateObject(options, new ValidationContext(options), validationResults, validateAllProperties: true)) { foreach (var result in validationResults) { errors.Add(result.ErrorMessage ?? "Cisco connector options validation failed."); } } } }