Skip to content

Return custom result type from IValitResult<T> and IValitator<T> #161

@GooRiOn

Description

@GooRiOn

I think it could be a nice feature to allow defining output result from IValitRules<T> like follows:

ValitRules<Model>
    .Create()
    .Ensure(....)
    .WithResult(r => new MyResult { ....})
    .Validate();

Things are little bit more complicated in IValitator<T> because here we would have to add generic interface like IValitator<TModel,TResult> and create abstract class which would take in the ctor Func<ValitResult, TResult>. But overall I think this would be very cool because folks can add Valit to their projects without changing the existing infrastructure related to error handling. What's your optinion on that one?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions