-
Notifications
You must be signed in to change notification settings - Fork 0
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
support automatically hydrating nested domain objects when instantiating #5
Comments
potentially could use a custom transformer to do this for us. For example, here is a transformer that uses type defs to create functions: https://github.com/woutervh-/typescript-is although this would require using so, for example, it would transform our type defs where any time a property is a -- until we have that, we could just support the user defining dependencies manually. Not ideal since we're duplicating information... but would solve this too |
note: per #6, if we have a function that is able to make the type definitions accessible at runtime, we should be able to solve this problem options:
perhaps even, we import the DomainObject class into the |
yeah! that works!
so we can have it wouldn't even have to generate the full (e.g., in the a problem could arise when users accidentally import domain objects directly, instead of from the alternatively, we can import the decorations in each model file. (it does suck that its getting a little "magical" now though - since there is an import that is globally affecting other things...) |
we could also have
|
what if the contract was, to still be explicit:
-vs-
|
so, effectively, |
note: we want to make sure that the error thrown has full context of object if there is validation. i.e.,: validate, THEN hydrate. |
before the |
done w/ tag v0.5.0 |
for example:
we are required to do
new Directory(userDir)
in order to usegetUniqueIdentifier()
, since otherwiseuserDir
is just anobject
, not aninstanceof DomainObject
, because when user was instantiated it was instantiated asnew User(dbObject)
--
we are told about the DomainObject that each
User.directories[number]
is - but we are not told about that at run time. Only type defs know that - and those get compiled away :(is there another way to get the type definitions at run time?
The text was updated successfully, but these errors were encountered: