/// <summary> /// Register an error with the validation context. /// </summary> /// <param name="error">Error to register.</param> public void AddError(OpenApiValidatorError error) { if (error == null) { throw Error.ArgumentNull(nameof(error)); } _errors.Add(error); }
/// <summary> /// Helper method to simplify validation rules /// </summary> public static void CreateError(this IValidationContext context, string ruleName, string message) { OpenApiValidatorError error = new OpenApiValidatorError(ruleName, context.PathString, message); context.AddError(error); }