-
Notifications
You must be signed in to change notification settings - Fork 31
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
Validations may be executed multiple times for the same object #204
Comments
@andylowry, Some thoughts:
Agreed, we do need to validate the referenced objects, and we don't want to repeat that part of it.
I think we have to distinguish between validation contexts. The first time we see a reference to a given object:
I am assuming we need to validate the referent object in every context where it's referenced, but only if the referrer has constraints that apply to that object, and only those constraints. We should not need to re-validate the object in its own context more than once. In the above example, one we've verified that the referent Schema Object follows the rules that apply intrinsically to all Schema Objects, we should not need to re-evaluate those rules. |
This happens, for example, when a value is incorporated by one or more references, perhaps in addition to as an inline element.
It's not enough to skip reference targets in validation, since some values may appear only via reference.
Probably what's needed is an
IdentityHashSet
of validated objects, maintained during validation.This is actually much subtler than it appears. For example, perhaps there's a case where the same numeric value must be non-negative in one context but not in another. Clearly, if the more constrained context is encountered later than the other, it would be a mistake to suppress the non-negative check just because the number has already been validated. Thought is needed.
The text was updated successfully, but these errors were encountered: