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

Child Validators should receive a reference to the Parent Context #1945

Merged
merged 3 commits into from May 24, 2022

Conversation

guffy1234
Copy link
Contributor

Hi

As I told you in #1942 it would be nice to just restore the link between parent context and children contexts. This will allow to creation of custom root contexts and traverse to root from any child validator. Otherwise, the existence of ParentContext property is just senseless.
As you said it's a volunteer project, so I trying to help you with MR. :)
I removed the obsolete boolean property and change the code to propagate _parent value by default.

@dnfadmin
Copy link
Collaborator

dnfadmin commented May 24, 2022

CLA assistant check
All CLA requirements met.

Copy link
Member

@JeremySkinner JeremySkinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, I need to do some testing to make sure there are no unexpected side affects of doing this, but in principle I think this should be fine. A few changes that'll be needed though:

  • Changing the method signature of CloneForChildValidator is a breaking change, which should be avoided outside of major version releases. This change should be reverted as it's breaking the build.
  • The calling method (ChildValidatorAdaptor.CreateNewValidationContextForChildValidator) should be updated to pass true as the second argument rather than removing the argument entirely.
  • Please make sure you sign the CLA too or we won't be able to accept the PR

Once you've made these changes I'll be able to get this merged.

Thanks for wanting to be involved!

@JeremySkinner JeremySkinner added this to the 11.0.2 milestone May 24, 2022
@JeremySkinner JeremySkinner merged commit 7322629 into FluentValidation:main May 24, 2022
@JeremySkinner
Copy link
Member

Merged, thanks. I'll aim to push out a release on Friday.

@JeremySkinner JeremySkinner changed the title Restore linking between chaildren and parent contexts Child Validators should receive a reference to the Parent Context May 27, 2022
@JeremySkinner
Copy link
Member

Released in 11.0.2

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

3 participants