0.1.5 • Published 5 years ago

brief-swagger-ui-dist v0.1.5

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

npm.io

Use markdown table to render request/response params

npm.io

Usage

work with swagger-ui-express:

import express from 'express';
import yaml from 'js-yaml';
import swaggerUiExpress from 'swagger-ui-express';
import swaggerUiDist from 'brief-swagger-ui-dist';

/**
 *
 * @param {import('core/api/server').Server} server
 * @param {import('express').Router} router
 */
export async function buildSwaggerUi(server, router) {
  const swaggerJson = {...};

  // @ts-ignore
  // eslint-disable-next-line prefer-const
  let [swaggerInitJsRouter, swaggerUIStaticFileRouter] = swaggerUiExpress.serve;
  swaggerUIStaticFileRouter = express.static(swaggerUiDist.getAbsoluteFSPath(), { index: false });

  const indexHtmlRouter = swaggerUiExpress.setup(swaggerJson, {
    explorer: true,
    swaggerOptions: {
      filter: true,
      withCredentials: true,
    },
  });

  router.use(swaggerInitJsRouter, swaggerUIStaticFileRouter, indexHtmlRouter);
}

Contributing

# development
npm run dev
open http://127.0.0.1:3200/
# using oas3(Swagger V3) swagger.json or swagger.yml

# publish
npm run build
# edit package.json version
cd swagger-ui-dist-package
./deploy.sh
0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago