Skip to content

Add useInject option to generate inject() instead of constructor injection - #413

Closed
sod wants to merge 1 commit into
cyclosproject:masterfrom
sod:use-inject
Closed

sod wants to merge 1 commit into
cyclosproject:masterfrom
sod:use-inject

Conversation

@sod

@sod sod commented Nov 11, 2026

Copy link
Copy Markdown

inject() is the recommended DI style and lets subclasses of generated services skip repeating the base constructor's parameters.

I made it opt-in via useInject: true to not break code that does new FooClient(config, client). That won't work anymore with inject, as the constructor arguments are gone.

useInject: true will reduce the generated code, as inject is only needed on the base class. The clients don't have to pass them down anymore.

…ction

inject() is the recommended DI style and lets subclasses
of generated services skip repeating the base constructor's parameters.
It defaults to false, because services created with `new` or subclasses
calling super(config, http) would break.
@sod

sod commented Nov 17, 2026

Copy link
Copy Markdown
Author

Feel free to reopen and merge. But we don't need it anymore.

@sod sod closed this Nov 17, 2026
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.

1 participant