Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to have conditional rules in contracts #6

Open
thiagolunardi opened this issue Nov 8, 2017 · 6 comments
Open

Add ability to have conditional rules in contracts #6

thiagolunardi opened this issue Nov 8, 2017 · 6 comments
Assignees

Comments

@thiagolunardi
Copy link

Example:

Contract .Required() .IfNotNull(x.LastName, contract => contract.MinLength(3));
Means: LastName is not required, but if informed, must have more 3 letters or more.

@fgemig
Copy link

fgemig commented Dec 26, 2017

I agree! A conditional validation is extremely useful!

mstrYoda added a commit to mstrYoda/flunt that referenced this issue Aug 30, 2018
…ract

Desired example use case in issue:

Contract.Required().IfNotNull(x.LastName, contract => contract.MinLength(3));

Implemented feature :

_dummy = new Dummy();
_dummy.stringProp = "abc";

var wrong = new Contract()
    .Requires()
    .IfNotNull(_dummy.stringProp, x => x.IsDigit(_dummy.stringProp, nameof(_dummy.stringProp), "Property should be digit if not null"));
andrebaltieri added a commit that referenced this issue Apr 2, 2019
Issue #6 Added Ability To Have Conditional Rules In Contract
@andrebaltieri andrebaltieri self-assigned this Feb 1, 2021
@andrebaltieri andrebaltieri added this to the Flunt Release Q1 - 2021 milestone Feb 1, 2021
@andrebaltieri
Copy link
Owner

Moved to version 2! Check milestones!

@leandro-almeida
Copy link

This feature is a must have!

@filipimosquini
Copy link

Is there any prediction for this feature to be available?

@andrebaltieri
Copy link
Owner

Sure @filipimosquini... there's a new version comming soon!

@andregr15
Copy link

I looked in the code and not find this feature. Is it removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants