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

Skip null validation on nullable types to prioritize other validations #73

Open
CesarD opened this issue Aug 1, 2024 · 0 comments
Open

Comments

@CesarD
Copy link

CesarD commented Aug 1, 2024

Is there a way to ignore the default null validation on nullable values if I don't care about that but I want to validate that, in case that the value is not null, for example I may want to perform other validation such as IsLongerThan(..) or anything else?

There are cases where I don't want to perform the null validation because that might be a valid value, but if there is actually a value, then I want to make sure it's no longer than a certain length or some other validation.

Example:

string? street = "123 Some Street";
Street = street.Throw().IsLongerThan(100);

Right now this is showing Warnings because string? must match notnull constraint to use it as parameter TValue.

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

No branches or pull requests

1 participant