Usage:

import routing from '@novice1/routing';
import {
OpenAPI,
Postman
BearerUtil
} from '@novice1/api-doc-generator';

const bearer = new BearerUtil('bearerAuth');
bearer.setBearerFormat('JWT');

// add it to OpenAPI security schemes
const openapi = new OpenAPI();
openapi.addSecuritySchemes(bearer);

// add it to Postman global authentication
const postman = new Postman();
postman.setAuth(bearer);

// router
const router = routing()
.get({
path: '/something',
auth: true,
parameters: {
// add security requirements for this route
security: bearer
}
}, function (req, res) {
// do something ...
});

Hierarchy (view full)

Constructors

Properties

bearerFormat?: string
description?: string
securitySchemeName: string
token?: string

Methods

  • Parameters

    • bearerFormat: string

      A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.

    Returns BearerUtil