You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of this is weak as it uses the (below mentioned) type guard, which only checks property existence. However, it may be a reasonable assumption that at runtime all such interfaces were created from factory functions and thus are valid anyway
A type guard validates the type
Ideally the entity could have its structure and type validated in one place.
The text was updated successfully, but these errors were encountered:
The current implementation of this is weak as it uses the (below mentioned) type guard, which only checks property existence.
One idea to improve this is to use recursion. E.g. the custom validator uses the factory function to construct an entity from a class. The entity would then be validated.
Though could this lead to an infinite loop? E.g. a child validates a parent, which validates it's children, and so on.
However, it may be a reasonable assumption that at runtime all such interfaces were created from factory functions and thus are valid anyway
Problem
Validation in the domain isn't easy to maintain
Ideally the entity could have its structure and type validated in one place.
The text was updated successfully, but these errors were encountered: