v-swagger

API document component like swagger style

Usage no npm install needed!

<script type="module">
  import vSwagger from 'https://cdn.skypack.dev/v-swagger';
</script>

README

v-swagger

API document component like swagger style

https://easylogic.github.io/v-swagger/index.html

Install

npm install v-swagger

Load

import VSwagger from 'v-swagger'

Vue.use(VSwagger)
or 

components: { 'v-swagger': VSwagger }

Use

<v-swagger :spec="spec" />
 new Vue({
        el: '#app',
        data: {
          spec: {
            host: "https://www.google.com",
            title: "Google Search",
            description: "Hello, API",
            opened: true,
            request: [{
                method: 'get',    // post, delete or put 
                description: "Google Home",
                url: "/"
              }
            ]
          }
        }
      })

Spec

Simple API Specification

{
  host: "https://api.xxx.me",
  title: "Market API",
  description: "Market, Transactions",
  opened: true,
  request: [ ... ] 
}

Request

URL called by http

{
  method: 'get',    // post, delete or put 
  description: "Retrieve Information List.",
  url: "/trade/list/{id}/{name}",
  headers: [{
    key: "Authorization",
    description: "Bearer {{access_token}}"
  }],
  path: [{
      key: "id",
      items: ["happydeveloper"],
      description: "write a id"
    },
    {
      key: "name",
      description: "This is name"
    }
  ],
  params: [{
    key: "name",
    type: "string",
    description: "query string name",
    required: true
  }],
  body: {
    required: true,
    contentType: "application/json",
    data: {
      "petId": 0,
      "quantity": 0,
      "shipDate": "2018-07-14T14:10:33.646Z",
      "status": "placed",
      "complete": false
    }
  }

}