Global

Members

predefinedSpec

Source:

responseMiddlewareHasBeenApplied

Source:
used make sure the *order* of which the middlewares are applied is correct The `response` middleware MUST be applied FIRST, before the `request` middleware is applied. We'll use this to make sure the order is correct. If not - we'll throw an informative error.

Methods

handleRequests(options)

Source:
apply the `request` middleware Applies to the `app` you provided in `handleResponses` Also, since this is the last function you'll need to invoke, it also initializes the specification and serves the api documentation. The options are for these tasks.
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Default Description
path string <optional>
api-docs where to serve the openAPI docs. Defaults to `api-docs`
predefinedSpec * <optional>
{}
Returns:
void

handleResponses(expressApp, optionsopt)

Source:
apply the `response` middleware.
Parameters:
Name Type Attributes Description
expressApp Express the express app
options Object <optional>
optional configuration options
Properties
Name Type Attributes Default Description
pathToOutputFile string | undefined <optional>
where to write the openAPI specification to. Specify this to create the openAPI specification file.
writeIntervalMs number <optional>
10000 how often to write the openAPI specification to file
Returns:
void

init(aApp, aPredefinedSpecopt, aPathopt, aWriteIntervalopt, aApiDocsPathopt)

Source:
initialize the `express-oas-generator`. This will apply both `handleResponses` and `handleRequests` and also will call `serveApiDocs`.
Parameters:
Name Type Attributes Default Description
aApp Express the express app
aPredefinedSpec * <optional>
{}
aPath string | undefined <optional>
where to write the openAPI specification to. Specify this to create the openAPI specification file.
aWriteInterval number <optional>
10000 how often to write the openAPI specification to file
aApiDocsPath string <optional>
api-docs where to serve the openAPI docs. Defaults to `api-docs`

serveApiDocs(options)

Source:
serve the openAPI docs with swagger at a specified path / url
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Default Description
path string <optional>
api-docs where to serve the openAPI docs. Defaults to `api-docs`
predefinedSpec * <optional>
{}
Returns:
void