Socket
Socket
Sign inDemoInstall

openapi-mock-server-codegen

Package Overview
Dependencies
98
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    openapi-mock-server-codegen

openapi(v2 or v3) mock server codegen


Version published
Weekly downloads
22
decreased by-31.25%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

OpenAPI-Mock-Server-Codegen

An OpenAPI mock server code generation tool.With this tool, you can directly generate a server supported by the koa (currently supported) framework through swagger.json/swagger.yaml

Install

npm install -g openapi-mock-server-codegen

Getting started

You can execute commands directly in the CMD environment

mock codegen -td D:\templates -cd D:\server
Command Parameters
parameter nameinfo
-td, --templateDirTemplate files dir. You can place multiple swagger files in this directory
-cd, --codeDirThe server code generation directory
--apithe path of OpenAPI definition file

Server usage

Start server

Execute the following command in the root directory of the generated code

node index.js
Server config

config.json file in the code root directory

iteminfo
portPort number used by koa, default: 3020
randomRespWhether to randomly generate the response defined in the response field, default: true
useDictWhether to use a dictionary to tell the faker framework what kind of data this field needs to generate, default: true
localeThe localized language currently used by faker, default: "en_US"

Keywords

FAQs

Last updated on 09 Aug 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc