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

Introduce new syntax for Transform, deprecate the old version #1613

Merged
merged 1 commit into from Jan 31, 2021

Conversation

JeremySkinner
Copy link
Member

@JeremySkinner JeremySkinner commented Jan 14, 2021

Marks the current Transform syntax as obsolete, and introduces a new transform syntax as part of the call to RuleFor.

Old:

RuleFor(x => x.SomeInt).Transform(i => i.ToString()).NotEqual("0");

New:

Transform(from: x => x.SomeInt, to: i => i.ToString()).NotEqual("0");

There is also a TransformForEach method available (equivalent of the old RuleForEach(expr).Transform(transformer))

This change is needed as we're moving to generics in the internal API for FluentValidation 10, which means transforming the type will no longer be possible after rules have been created.

The old syntax should be deprecated in the next 9.x release, and removed in 10.0.

@JeremySkinner JeremySkinner added this to the 9.5 milestone Jan 14, 2021
@JeremySkinner JeremySkinner force-pushed the issue/transform-changes branch 3 times, most recently from 9f3a20b to 39a9b5b Compare January 31, 2021 16:19
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

Successfully merging this pull request may close these issues.

None yet

1 participant