ValidatingAsync & ValidatedAsync not raised during the content creation
What I notice is that when I create or publish content item(s), both ValidatingAsync & ValidatedAsync are not triggered, which is weird from the user perspective, because OC already did validate the fields
Why are these sorts of events called once you call ContentManager.ValidateAsync()? What if I want to intercept the content creation and do some validation?!!
I did a workaround by cancelling the process on publishing if the validation goes wrong
@Piedone @BenedekFarkas, is this by design while you are still managing some Orchard apps?
No idea what the exact intent here was, but please formulate the problem and suggested fix in more detail. Also check out, there were discussions about this not long ago (not sure if issue, GitHub discussion, or Discord).
- Create a
ContentPartHander - Override
ValidatingAsyncevent - Publish a content item that contains that part
- The event is not triggered
The expectation that the event should hits
IDK, but O1 had (probably still has) similar issues where happy path testing didn't surface something that later seemed an obvious flaw/omission, e.g. https://github.com/OrchardCMS/Orchard/pull/8844/files#diff-32ba9042e7ffe517e3958c726eeca207d8591c7fa16ff763521eb60d6c7cec24R231-R237.
but O1 had similar issues
Some things can't be evaluating at all times because they are too costly. This was a reason some validation was not applied for anything that happens on a content item. These events might just be triggered in UI related events.
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).
This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.
IMHO, the simple approach is to call ContentManager.Validate() before publishing the content, if there's no objection I will submit a PR