Skip to content

Support injecting annotated types with Inject[] #279

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

Merged
merged 3 commits into from
Aug 18, 2025

Conversation

davidparsson
Copy link
Collaborator

This was missing in #263.

@davidparsson
Copy link
Collaborator Author

@sheinbergon, would you mind reviewing this (with #263 as context)? Have I missed anything else?

@sheinbergon
Copy link
Collaborator

Sure. Will do it later on today

Copy link
Collaborator

@sheinbergon sheinbergon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going over the codebase, annotated type re-creation seems correct. I do wonder if we should really support nested type defs as part of the practical use.

IMO, It just doesn't feel like a proper use case (especialy given what what _inject_marker and _noinject_marker aim to solve). If it were up to me, I would favor a more hierarchical approach

Anyhow, If you consider this valid (or if the rest of the codebase already does so), please ignore this comment, and I'll aprove this PR.

We should re-activate coverage measurement (I can't do it as a mainatiner, I believe)

@jstasiak
Copy link
Collaborator

IMO, It just doesn't feel like a proper use case (especialy given what what _inject_marker and _noinject_marker aim to solve)

Random driveby comment: when I still worked on this library I actually planned to get rid of the inject decorator and noninjectable/NoInject too (not useful as they only solve problems with the inject decorator); only the Inject type would be used to declare injectable parameters in that situation.

This could simplify some parts of the implementation but also comes with some drawbacks.

@jstasiak
Copy link
Collaborator

We should re-activate coverage measurement (I can't do it as a mainatiner, I believe)

You're right. I just sent @davidparsson an invitation to the GH organization (not just this repository), Coveralls needs to be granted access to the organization and then I think the repository needs to be activated in the Coveralls settings. Let me know if more information is needed about any of this.

To avoid the test from passing by just binding the origin type.
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.29%. Comparing base (9e68690) to head (eb338b8).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #279      +/-   ##
==========================================
+ Coverage   95.23%   95.29%   +0.05%     
==========================================
  Files           1        1              
  Lines         567      574       +7     
  Branches       96       98       +2     
==========================================
+ Hits          540      547       +7     
  Misses         20       20              
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

`__metadata__` is never empty.
@sheinbergon sheinbergon self-requested a review August 18, 2025 09:19
@davidparsson davidparsson merged commit d6e0ea4 into master Aug 18, 2025
13 checks passed
@davidparsson davidparsson deleted the fix-annotated-inject branch August 18, 2025 11:18
@davidparsson
Copy link
Collaborator Author

IMO, It just doesn't feel like a proper use case (especialy given what what _inject_marker and _noinject_marker aim to solve)

Random driveby comment: when I still worked on this library I actually planned to get rid of the inject decorator and noninjectable/NoInject too (not useful as they only solve problems with the inject decorator); only the Inject type would be used to declare injectable parameters in that situation.

This could simplify some parts of the implementation but also comes with some drawbacks.

There might very well be internal benefits with this, but it would be a painful migration in large projects. I'm using this in a codebase with 1500+ @inject decorators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants