Skip to content
Discussion options

You must be logged in to vote

Unfortunately, DI is not possible in OAS Tools currently. However, since the framework is flexible enough, you could implement a basic DI that can serve your purpose. To do that, you need to create a new external module that replaces the router middleware and add it to the OAS Tools chain through oasTools.use( ). You could then inject your dependencies through this new module's configuration:

  1. Create a new file for the new module and copy the router middleware code inside:
// newRouter.js
import { OASBase, errors, logger } from "@oas-tools/commons";
import { commons } from "../../utils/index.js";
import { pathToFileURL } from "url";

export class OASRouter extends OASBase {

  constructor(

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@koubas
Comment options

Answer selected by koubas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants