-
Notifications
You must be signed in to change notification settings - Fork 800
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
getFromContainer
is called too early
#328
Comments
Same problem here! Without calling |
Possible fix: #335 |
@satanTime and @humbertowoody, can you please test again using the pre-release of the I've published the pre-release to NPM to make it easier to test. |
Hi @jotamorais, the problem is not with the |
Hi @vlapo, could you leave any thoughts or to point to the right person for the review? Implementation in routing-controllers was changed a bit, you can find it here: Implementation in typeorm is quite the same: Please let me know which way you prefer and I'll update my PR. |
Hi @vlapo, any update? I've updated the PR to follow |
Hi @jotamorais, do you know anyone from |
Hi, any update on this? |
Happy testing https://www.npmjs.com/package/class-validator/v/0.12.0-rc.0. Please give me a feedback. |
On my project it works well now with |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When I want to use own container, I call it in my
index.ts
but the problem is, that
MetadataStorage
in this case will be replaced with a brand new instance ofMetadataStorage
, because the call ofuseContainer
is made after all annotations have been parsed and myContainer
fromtypedi
doesn't them yet and wasn't used to collect them. Therefore the conclusion that we can't useMetadataStorage
andgetContainer
, and should exclude it from thegetFromContainer
.The problem is caused by decorators from
src/decorator/decorators.ts
because they usegetFromContainer(MetadataStorage)
too early, before the very first place where we could calluseContainer
.Currently I investigated
class-transformer
because it doesn't have this issue, looks like it happens because it uses ownMetadataStorage
without container.I've created a pull request to fix the issue, please check it and let me know what you think.
Thank you in advance.
The text was updated successfully, but these errors were encountered: