Giter VIP home page Giter VIP logo

swagger-express-middleware-with-chance's Introduction

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.

swagger-express-middleware-with-chance's People

Contributors

elgalu avatar jamesmessinger avatar joshuajabbour avatar owenbrotherwood avatar rkrauskopf avatar stevenewhouse avatar winniehell avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.