Skip to content

Command.Validators should be invoked only when the command options are arguments are valid #2779

@9rnsr

Description

@9rnsr

For Option<T> and Argument<T>, custom validators are invoked before the conversion from the token (string) to T. It's well behavior for the use case such the production of better error messages, even so the behavior is not well documented (related #2645).

For Command, as same as above, validators are invoked before its options and arguments today, but it's useless.

I expect to be able to use Command validators for the complex validation of our command line. In other words, the options and arguments should be validated with their definitions (Arity, AllowMultipleArgumentsPerToken, CustomParser, etc, and Validators) first, then only when no one have any errors, the command validators should be invoked.

Or, reading the values of options and arguments from Command.Validators is incorrect? If so, better documentation is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions