Skip to content

[BUG] [typescript-nestjs-server] Cannot use Injectables in ApiImplementations #21842

@Pranen

Description

@Pranen
Description

If I want to implement a functionality in an ApiInterface i cannot inject services from the AppModule because they are not known to the ApiModule which is creating all those instances.

openapi-generator version

7.15

Steps to reproduce

Take the PetStore-Demo and add a TestService which is called from the UserService in the constructor:

@Injectable() export class TestService { hello(): string { return "Hello World"; } }

`@Injectable()
export class UserService implements UserApi {

constructor(private readonly testService: TestService) {}`

If you do that, you'll receive an error in the startup:

Nest can't resolve dependencies of the UserService (?). Please make sure that the argument TestService at index [0] is available in the ApiModule context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions