brief-swagger-ui-dist

0.1.5 • Public • Published

Use markdown table to render request/response params

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

Readme

Keywords

none

Package Sidebar

Install

npm i brief-swagger-ui-dist

Weekly Downloads

2

Version

0.1.5

License

Apache-2.0

Unpacked Size

10.2 MB

Total Files

18

Last publish

Collaborators

  • tianjianchn