SudoSOS Back-end API / internal/swagger / Swagger
Class: Swagger ​
Constructors ​
Constructor ​
ts
new Swagger(): Swagger;Returns ​
Swagger
Methods ​
generateSpecification() ​
ts
static generateSpecification(app, filesPattern): Promise<SwaggerSpecification>;Generate Swagger specification on-demand and serve it.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
app | Application | The express application to mount on. |
filesPattern | string[] | Glob pattern to find your jsdoc files |
Returns ​
Promise<SwaggerSpecification>
The Swagger specification with model validator.
importSpecification() ​
ts
static importSpecification(file?): Promise<SwaggerSpecification>;Imports a pre-generated Swagger specification file.
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
file | string | 'out/swagger.json' | The path to the Swagger JSON file. |
Returns ​
Promise<SwaggerSpecification>
initialize() ​
ts
static initialize(app): Promise<SwaggerSpecification>;Initializes the Swagger specification for the current environment and serve it. Depending on the NODE_ENV, it will be generated on-demand or import a pre-generated specification.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
app | Application | The express application which will serve the specification. |
Returns ​
Promise<SwaggerSpecification>