Skip to content
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

feat: include the current request context when resolving controller from IoC #497

Merged
merged 3 commits into from
Apr 22, 2020

Conversation

adenhertog
Copy link
Contributor

The action object is useful when resolving controller instances from the IoC provider, as the context is often used to add additional bindings for objects in a per-request lifecycle scope.

This change sends the action object as a second parameter in the get() method that's used when resolving controllers. This has been added as an optional parameter to achieve backwards compatibility.

The existing code also assumed that all IoC providers expose this get() method, which isn't always the case. An IoCAdapter interface has been added that can be implemented by consumers who use other providers.

Lastly the class-validator library has been split into a peer-dependency which closes #384

* pass action through to IocAdapter

* make class-validator a peer dependency

* make package public

* use correct github org

* npm scripts for publish

* fix readme example

* improve type clarity

* reuse type definition
@github-actions
Copy link

github-actions bot commented Feb 5, 2020

Stale pull request message

@github-actions github-actions bot closed this Feb 13, 2020
@jotamorais jotamorais reopened this Feb 20, 2020
@jotamorais jotamorais merged commit 763ec24 into typestack:master Apr 22, 2020
@typestack typestack locked as resolved and limited conversation to collaborators Aug 9, 2020
@NoNameProvided
Copy link
Member

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@NoNameProvided NoNameProvided changed the title Include the current request context when resolving controller from IoC feat: include the current request context when resolving controller from IoC Aug 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Routing-Controllers + class-validator bug?
3 participants