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

Filter out props for validation #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kraviecc
Copy link

Context

We have:

  • MiniValidator.TryValidateAsync (or any other method) with recurse disabled
  • Object that has a property without any validation attribute example and which can:
    • Throw an exception (due to not implemented or temporal data inconsistency) from a property getter which is of a type that has at least one validation attribute
    • Trigger data (lazy) loading from a database that can lead, in specific scenarios, to deadlocks

For such a scenario, when we try to validate an instance of the class we get an exception (or data lazy loading) even though the engine shouldn't validate the problematic property - it doesn't have any validation attribute nor recurse is enabled.

Solution

Filter out properties without any validation attribute only when the recurse is disabled.

that don't have any validation attribute and when recurse is disabled
@Kraviecc
Copy link
Author

hey @DamianEdwards, do you have time to review the changes?

@Kraviecc Kraviecc force-pushed the feature/omit-unnecessary-prop-evaluation branch from 1abda3d to d618f6e Compare July 8, 2024 09:10
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.

1 participant