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
{{ message }}
Repository navigation
docs: add minimal example for usage with inversify #607
Error: No matching bindings found for serviceIdentifier: CustomConstraint
at _validateActiveBindingCount (/home/nodebrick/application/node_modules/inversify/lib/planning/planner.js:62:23)
at _getActiveBindings (/home/nodebrick/application/node_modules/inversify/lib/planning/planner.js:48:5)
at _createSubRequests (/home/nodebrick/application/node_modules/inversify/lib/planning/planner.js:85:26)
at Object.plan (/home/nodebrick/application/node_modules/inversify/lib/planning/planner.js:136:9)
at /home/nodebrick/application/node_modules/inversify/lib/container/container.js:317:37
at Container._get (/home/nodebrick/application/node_modules/inversify/lib/container/container.js:310:44)
at Container.get (/home/nodebrick/application/node_modules/inversify/lib/container/container.js:230:21)
at InversifyContainerWrapper.get (/home/nodebrick/application/packages/nodebrick-core/src/di/InversifyContainerWrapper.ts:23:45)
at getFromContainer (/home/nodebrick/application/node_modules/src/container.ts:53:44)
at ConstraintMetadata.get [as instance] (/home/nodebrick/application/node_modules/src/metadata/ConstraintMetadata.ts:46:16)
Just wondering If some more changes need to be done
https://github.com/typestack/class-validator/search?q=getFromContainer&unscoped_q=getFromContainer
Without useContainer I think it doesn't solve dependencies and they are undefined, please check them in constructors of your validators.
And might you share code of CustomConstraint?
@satanTime I'm facing this problem too using class-validator with inversify. I do not have a CustomConstraint class defined anywhere in my code. What could be the reason? Are there any instructions for using class-validator with inversify or a code sample?
@satanTime ok after some googling, I found that it is necessary to use an adaptor for third party DI containers such as inversify to work. Obviously this must be the reason for me since I was not aware of that. It's not super obvious to someone who's only using class validator and not routing controllers. Maybe update the documentation for class-validator to link to that?
I am using routing-controllers, inversify and class-validator.
Error: Missing required @injectable annotation in: Validator. node-app | at getTargets (/usr/src/app/node_modules/inversify/src/planning/reflection_utils.ts:32:11) node-app | at getDependencies (/usr/src/app/node_modules/inversify/src/planning/reflection_utils.ts:14:10) node-app | at /usr/src/app/node_modules/inversify/src/planning/planner.ts:179:43 node-app | at Array.forEach (<anonymous>) node-app | at _createSubRequests (/usr/src/app/node_modules/inversify/src/planning/planner.ts:164:18) node-app | at plan (/usr/src/app/node_modules/inversify/src/planning/planner.ts:240:5) node-app | at /usr/src/app/node_modules/inversify/src/container/container.ts:623:25 node-app | at InversifyContainerAdapter.Container._get (/usr/src/app/node_modules/inversify/src/container/container.ts:574:37) node-app | at InversifyContainerAdapter.Container._getButThrowIfAsync (/usr/src/app/node_modules/inversify/src/container/container.ts:580:25) node-app | at InversifyContainerAdapter.Container.get (/usr/src/app/node_modules/inversify/src/container/container.ts:325:17)
Activity
nolazybits commentedon May 12, 2020
So I had to actually remove the use of the DI container all together it seems to have it working
Is that correct?
Before
I removed the ☝️ code and it works. Is that the correct approach?
Cheers :)
satanTime commentedon May 12, 2020
Without useContainer I think it doesn't solve dependencies and they are undefined, please check them in constructors of your validators.
And might you share code of
CustomConstraint?harindaka commentedon Nov 28, 2020
@satanTime I'm facing this problem too using class-validator with inversify. I do not have a
CustomConstraintclass defined anywhere in my code. What could be the reason? Are there any instructions for using class-validator with inversify or a code sample?satanTime commentedon Nov 28, 2020
Hi @harindaka,
Is there a chance to create an example with min code to reproduce the issue?
harindaka commentedon Nov 28, 2020
@satanTime ok after some googling, I found that it is necessary to use an adaptor for third party DI containers such as inversify to work. Obviously this must be the reason for me since I was not aware of that. It's not super obvious to someone who's only using class validator and not routing controllers. Maybe update the documentation for class-validator to link to that?
satanTime commentedon Nov 28, 2020
@harindaka, yep, makes sense, might you create a PR? I think you know better how to describe it.
Linked README to third pary IoC provider usage documentation
harindaka commentedon Nov 28, 2020
@satanTime done
[-]missing binding CustomConstraint[/-][+]docs: add minimal example for usage with inversify[/+]dreamerblue commentedon Feb 28, 2021
Same issue. Any progress for supporting inversify?
afraz-khan commentedon Nov 23, 2021
any official documentation piece for this?
ttruongatl commentedon Jan 18, 2022
The following could be a solution!
LimbersMay commentedon Aug 10, 2023
@ttruongatl I tried your solution but now I get:
I am using routing-controllers, inversify and class-validator.
Error: Missing required @injectable annotation in: Validator. node-app | at getTargets (/usr/src/app/node_modules/inversify/src/planning/reflection_utils.ts:32:11) node-app | at getDependencies (/usr/src/app/node_modules/inversify/src/planning/reflection_utils.ts:14:10) node-app | at /usr/src/app/node_modules/inversify/src/planning/planner.ts:179:43 node-app | at Array.forEach (<anonymous>) node-app | at _createSubRequests (/usr/src/app/node_modules/inversify/src/planning/planner.ts:164:18) node-app | at plan (/usr/src/app/node_modules/inversify/src/planning/planner.ts:240:5) node-app | at /usr/src/app/node_modules/inversify/src/container/container.ts:623:25 node-app | at InversifyContainerAdapter.Container._get (/usr/src/app/node_modules/inversify/src/container/container.ts:574:37) node-app | at InversifyContainerAdapter.Container._getButThrowIfAsync (/usr/src/app/node_modules/inversify/src/container/container.ts:580:25) node-app | at InversifyContainerAdapter.Container.get (/usr/src/app/node_modules/inversify/src/container/container.ts:325:17)