Open drinkynet opened 2 years ago
When would you throw the error? The event not having a parent event set is only really an error during serialization, but we don't have enough context in the serializer there to determine easily if the session property is set.
It would make sense to do it during serialisation as that is the exact point it should all be valid. Otherwise you'd be wrongly throwing exceptions while building up the model.
I suppose you'd need some pre-serialisation validation method/rule on the model that the serialiser could be aware of to call. But I guess we're into quite a bit of complexity for a little bit of convenience here, and maybe catching it in the validator is fine :)
Might be worth the library throwing a RuntimeException here so that the error can be picked up in development before using the validator.