Changeset 17481 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/ConcreteRestrictedArrayJsonItem.cs
- Timestamp:
- 03/17/20 17:03:24 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/ConcreteRestrictedArrayJsonItem.cs
r17473 r17481 9 9 public IEnumerable<T> ConcreteRestrictedItems { get; set; } 10 10 11 protected override boolValidate() {11 protected override ValidationResult Validate() { 12 12 bool res = true; 13 IList<string> errors = new List<string>(); 13 14 foreach(var x in Value) { 14 15 bool tmp = false; … … 16 17 tmp = tmp || x.Equals(restrictedItem); //if one tmp is true, it stays true (match found) 17 18 } 19 if (!tmp) 20 errors.Add($"[{Path}]: Value '{x}' is not one of the allowed values: " + 21 $"'{ string.Join(",", ConcreteRestrictedItems.Select(s => s.ToString()).ToArray()) }'."); 18 22 res = res && tmp; //if one tmp is false, res will set false 19 23 } 20 return res; 24 if (res) 25 return ValidationResult.Successful(); 26 else 27 return ValidationResult.Faulty(errors); 21 28 } 22 29 }
Note: See TracChangeset
for help on using the changeset viewer.