Example #1
0
 public bool HasErrors(ErrorKinds errorKind) => Errors.Any(x => (x.ErrorKind & errorKind) == errorKind);
Example #2
0
        internal static List <Error> Validate(this IEnumerable <ValidationAttribute> validationAttributes, string name, string path,
                                              string jsonName, string jsonPath, string displayName, object value, ErrorKinds errorKind)
        {
            var errors = new List <Error>();

            foreach (var attribute in validationAttributes)
            {
                string errorMessage;

                if ((errorMessage = attribute.CheckValidationAttribute(displayName, value)) != null)
                {
                    errors.Add(new Error
                    {
                        ErrorKind = errorKind,
                        ErrorType = attribute.GetType(),
                        JsonName  = jsonName,
                        JsonPath  = jsonPath,
                        Message   = errorMessage,
                        Name      = name,
                        Path      = path
                    });
                }
            }

            return(errors);
        }