Swagger Web前后端分离辅助工具

Swagger是一个可以模拟前后端互动的软件

使用:

docker pull swaggerapi/swagger-ui 
docker run -p 4000:8080 swaggerapi/swagger-ui 
docker pull swaggerapi/swagger-editor 
docker run -p 5000:8080 swaggerapi/swagger-editor

打开 4000 或者 5000 看看。

这是它的文件, 可模拟前后端:

swagger: '2.0'
info:
  description: >-
    Web API
  version: '2017-07-03T03:04:01Z'
  title: moniter
host: xx.xxx.xx
basePath: /v1
schemes:
  - https
paths:
  /info/handle/list:
    get:
      tags:
        - 作业查询
      summary: 根据作业Handle查看任务列表
      produces:
        - application/json
      parameters:
        - name: id
          description: '查询条件,作业handle,可配合其他查询一起使用'
          in: query
          required: false
          type: string
        - name: platform
          description: 实例平台 aws/google 默认全部
          in: query
          required: false
          type: string
        - name: all
          description: '查询条件,ture表示列出所有作业信息,false则根据last参数决定,默认true'
          in: query
          required: false
          type: boolean
        - name: last
          description: '查询条件,all为false时有效,ture表示列出最后一次更新的作业信息,false列出历史作业信息,默认true'
          in: query
          required: false
          type: boolean
        - name: limit
          description: 返回作业数限制,默认10
          in: query
          required: false
          type: integer
        - name: page
          description: 作业页数,默认1
          in: query
          required: false
          type: integer
        - name: before
          description: 查询条件,在此时间前的作业
          in: query
          required: false
          type: string
        - name: after
          description: 查询条件,在此时间后的作业
          in: query
          required: false
          type: string
      responses:
        '200':
          description: 200 response
          schema:
            $ref: '#/definitions/Info'
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: '200'
        requestParameters:
          integration.request.querystring.id: method.request.querystring.id
          integration.request.querystring.platform: method.request.querystring.platform
          integration.request.querystring.after: method.request.querystring.after
          integration.request.querystring.before: method.request.querystring.before
          integration.request.querystring.last: method.request.querystring.last
          integration.request.querystring.page: method.request.querystring.page
          integration.request.querystring.limit: method.request.querystring.limit
          integration.request.querystring.all: method.request.querystring.all
        uri: 'http://xx.xxx.xx/xx'
        passthroughBehavior: when_no_match
        httpMethod: GET
        type: http
definitions:
  Info:
    type: object
    title: 任务查询结构
    properties:
      data:
        type: array
        description: 有效数据
        items:
          $ref: '#/definitions/InfoDetail'
      message:
        type: string
        description: 提示信息
      status:
        type: boolean
        description: 请求状态
      statusCode:
        type: integer
        format: int32
        description: 请求状态码
  InfoDetail:
    type: object
    title: 任务有效数据
    properties:
      sql:
        type: string
      limit:
        type: integer
        format: int32
        description: 个数限制
      offset:
        type: integer
        format: int32
        description: 偏移量
      page:
        type: integer
        format: int32
        description: 页码
      rows:
        type: integer
        format: int32
        description: 返回行数
      total:
        type: integer
        format: int32
        description: 总计行数
      raw:
        type: object
        description: 任务信息
        properties:
          container_id:
            type: string
            description: 容器ID
          created:
            type: string
            description: 容器创建时间
          handle:
            type: string
            description: 任务标志
          id:
            type: string
            description: 唯一标志
          instance_id:
            type: string
            description: 实例ID
          instancetype:
            type: string
            description: 实例类型
          job_data:
            type: string
            description: 作业详情
          last:
            type: boolean
            description: 是否最后更新
          localhost:
            type: string
            description: 私网host
          localip:
            type: string
            description: 私网IP
          mesosid:
            type: string
            description: Mesos-slave ID
          plat_form:
            type: string
            description: 实例平台
          publichost:
            type: string
            description: 公网host
          publicip:
            type: string
            description: 公网IP
          update_time:
            type: string
            description: 数据库更新时间