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

Issue with Validatior/TransactionContext system #62

Open
danrafd opened this issue Oct 20, 2016 · 1 comment
Open

Issue with Validatior/TransactionContext system #62

danrafd opened this issue Oct 20, 2016 · 1 comment

Comments

@danrafd
Copy link

danrafd commented Oct 20, 2016

Various validators can throw InvalidTransactionException during the IValidationContext.Ended event. However, at this point the HistoryContext override of OnEnded will already have logged the transaction and set the dirty flag. The exception is then thrown and the HistoryContext is now in an invalid state. This leads to documents being flagged as Dirty when they are in fact clean.

Perhaps validators should not throw during OnEnded - but during OnEnding instead. The transaction has supposedly ended and so it should not be possible to cancel it at that point.

There is a related issue here though in that some validators modify the Dom during OnEnding. This will mean that the order in which validators subscribe to the validation events is critical. Any modifications made to the Dom by a validator during OnEnding will not be validated by validators earlier in the subscription list.

It is possibly a mistake to mix the two different concepts of data validation and data coercion. Perhaps this issue could be worked around by separating the two - all 'Coercers' operate first then in a second pass, all Validators check the data consistency.

@abeckus
Copy link
Contributor

abeckus commented Oct 20, 2016

Thank you for posting this issue and suggesting solutions.
I will take a look at it for next update.
Please keep the issue open.
Alan

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

2 participants