Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-express-middleware-with-chance

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-express-middleware-with-chance

Swagger middleware and use chancejs mocks for Express

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-95%
Maintainers
1
Weekly downloads
 
Created
Source

Swagger Express Middleware of chancejs mock version

Swagger middleware and mocks for Express.js

Fork from swagger-express-middleware

Mock data using swagger-mock-parser

This Swagger middleware support random mock data while response schema has no example or default defined.

###Example

paths
  /api/mis/info:
    get:
      summary: Product Types
      description: |
        query mis
      parameters:
        - name: queryString
          in: query
          required: true
          type: string
          description: mis info
      responses:
        '200':
          description: mis user list
          schema:
            $ref: '#/definitions/MisInfoResult'
definitions:
  MisInfo:
    type: object
    properties:
      id:
        type: integer
        format: int32
        description: key
      login:
        type: string
        description: id
      name:
        type: string
        description: name
  MisInfoResult:
      type: object
      properties:
        code:
          type: integer
          format: int32
          description:
        message:
          type: string
        data:
          type: array
          items:
            $ref: '#/definitions/MisInfo'

When you use this example and visit '/api/mis/info' ,you will get

{
  "code": 123124,
  "message": "ORJ78pLt1",
  "data": [
    {
      "id": 6415711236784129,
      "login": "%ORJ78pLt1@qEAv$1A",
      "name": "syBQXMu2!n"
    },
    {
      "id": -571708163489791,
      "login": "Pu)HS%#1LzxEO",
      "name": "Mz[ith3o"
    },
    {
      "id": 2581669118738433,
      "login": "#Ne6slM6cW*acwlG",
      "name": "p)0HAWX6TF^#%%gQg6"
    },
    {
      "id": -8350341267455999,
      "login": "9fZEKmYQ3U^fDV",
      "name": "lZ9Cv@8yoS"
    },
    {
      "id": 2669672256241665,
      "login": "ZQpENhB!nJ9C7Ap^Au",
      "name": "mzWoEQk[EG[yLWy"
    }
  ]
}

The mock data will generate randomly each time by chanceJS,Though it has no meaningful. I suggest you use swagger-mock-file-generator to save a json file with example schema which generated by chancejs. It supports this project or swagger-express-middleware project.

License

Swagger Express Middleware is 100% free and open-source, under the MIT license. Use it however you want.

Keywords

FAQs

Package last updated on 21 Jul 2017

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc