|
var isValid = validationHelper.TryValidate(currentProperty, |
|
argumentIsSpecified, |
|
argumentValue, |
|
out var validationErrors); |
|
|
|
if (!isValid) |
|
{ |
|
allValidationErrors.AddRange(validationErrors); |
|
} |
We validate an argument as soon as it's parsed, but we should defer that until after all arguments are parsed. That gives validators the possibility to be conditional, e.g. "if argument A is true, argument B should be either 1 or 2 but not 0".
This means we should also give the complete Arguments object to ValidationHelper and pass it on to the ArgumentValidator too. That makes this a breaking change.
AtleX.CommandLineArguments/src/AtleX.CommandLineArguments/Parsers/CommandLineArgumentsParser.cs
Lines 65 to 73 in e10246d
We validate an argument as soon as it's parsed, but we should defer that until after all arguments are parsed. That gives validators the possibility to be conditional, e.g. "if argument A is true, argument B should be either 1 or 2 but not 0".
This means we should also give the complete
Argumentsobject toValidationHelperand pass it on to theArgumentValidatortoo. That makes this a breaking change.