Members
(inner) responseMiddlewareHasBeenApplied
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.
(inner) swaggerUiServePath
Methods
(inner) getMethod(req) → {Object|undefined}
Parameters:
Name | Type | Description |
---|---|---|
req |
Returns:
- Type
- Object | undefined
(inner) getPathKey(req) → {string|undefined|*}
Parameters:
Name | Type | Description |
---|---|---|
req |
Returns:
- Type
- string | undefined | *
(inner) getSpec() → {Object}
Returns:
- Type
- Object
(inner) handleRequests()
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.
Returns:
void
(inner) handleResponses(expressApp, optionsopt)
apply the `response` middleware.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
expressApp |
Express | the express app | ||||||||||||||||
options |
Object |
<optional> |
optional configuration options
Properties
|
Returns:
void
(inner) init(aApp, aPredefinedSpecopt, aSpecOutputPathopt, aWriteIntervalopt, aSwaggerUiServePathopt)
initialize the `express-oas-api`.
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> |
{}
|
|
aSpecOutputPath |
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 |
aSwaggerUiServePath |
string |
<optional> |
api-docs
|
where to serve the openAPI docs. Defaults to `api-docs` |
(inner) patchSpec(predefinedSpec) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
predefinedSpec |
Returns:
- Type
- Object
(inner) serveApiDocs()
serve the openAPI docs with swagger at a specified path / url
Returns:
void
(inner) setPackageInfoPath(pkgInfoPath)
Parameters:
Name | Type | Description |
---|---|---|
pkgInfoPath |
path to package.json |
(inner) updateSchemesAndHost(req)
Parameters:
Name | Type | Description |
---|---|---|
req |