Skip to content

Arguments should be validated after all arguments are parsed, not during parsing #36

@akamsteeg

Description

@akamsteeg

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions