New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

fastify-swagger-generate

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-swagger-generate

Generate Swagger/OpenAPI definition objects for fastify routes

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

fastify-swagger-generate

Generate Swagger/OpenAPI definitions without running fastify app !

  • fastify-swagger-generate

Install

npm i fastify-swagger-generate

Disclaimer

  • Only supports configuration based routes, i.e collection of route definitions
  • This library has no new content added
  • This library has just tweaked the original fastify-swagger

Usage

  • Create a generate.js file which looks like
const fastifySwagGen = require("fastify-swagger-generate");
const Routes = require("./routes");
const opts = {};

// generate swagger definitions
fastifySwagGen(opts, Routes, (err, definitions) => {
  // Write to a file
  require("fs")
    .createWriteStream("./app.swag.json")
    .write(JSON.stringify(definitions));
});
  • Let's say you have routes defined in routes.js
const routes = [
  {
    url: "/users/:id",
    method: "GET",
    schema: {
      params: {
        type: "object",
        properties: {
          id: {
            type: "number",
          },
        },
      },
    },
  },
];

module.exports = routes; // should be an iterable routes

API

Options

Refer here for more

Keywords

fastify

FAQs

Package last updated on 22 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts