template.default.swagger.yaml.vm Maven / Gradle / Ivy
swagger: '2.0'
info:
description: do1-framework是一个轻量级的Java快速开发平台,能快速开发项目并交付
version: 1.0.0
title: 基础框架
basePath: /do1-framework
schemes:
- http
#认证
securityDefinitions:
api_key:
type: "apiKey"
name: "token"
in: "header"
#定义接口数据
paths:
/${moduleName}/${pathName}/list:
get:
tags:
- ${comments}管理
summary: ${comments}列表
produces:
- application/json
parameters:
- name: page
description: 页码
in: query
type: integer
required: true
- name: limit
description: 每页条数
in: query
type: integer
required: true
- name: sidx
description: 排序字段
in: query
type: string
- name: order
description: 排序方式,如:asc、desc
in: query
type: string
responses:
'200':
description: 返回${comments}列表
schema:
$ref: '#/definitions/${className}EntityList'
/${moduleName}/${pathName}/info/{${pk.attrname}}:
get:
tags:
- ${comments}管理
summary: 获取${comments}信息
produces:
- application/json
parameters:
- name: ${pk.attrname}
description: ${className}ID
in: path
type: integer
required: true
responses:
'200':
description: 返回${comments}信息
schema:
type: object
properties:
code:
description: 状态码 0:成功 非0:失败
type: integer
format: int32
user:
$ref: '#/definitions/${className}Entity'
/${moduleName}/${pathName}/save:
post:
tags:
- ${comments}管理
summary: 添加${comments}
produces:
- application/json
parameters:
- name: body
description: ${comments}对象
in: body
type: string
schema:
$ref: '#/definitions/${className}EntityEdit'
required: true
responses:
'200':
schema:
$ref: '#/definitions/R'
/${moduleName}/${pathName}/update:
post:
tags:
- ${comments}管理
summary: 修改${comments}
produces:
- application/json
parameters:
- name: body
description: ${comments}对象
in: body
type: string
schema:
$ref: '#/definitions/${className}EntityEdit'
required: true
responses:
'200':
schema:
$ref: '#/definitions/R'
/${moduleName}/${pathName}/delete:
post:
tags:
- ${comments}管理
summary: 删除${comments}
produces:
- application/json
parameters:
- name: body
description: ${comments}ID列表
in: body
type: array
items:
type: integer
format: int64
default: 0
required: true
responses:
'200':
schema:
$ref: '#/definitions/R'
#定义数据模型
definitions:
${className}EntityList:
type: object
properties:
code:
description: 状态码 0:成功 非0:失败
type: integer
format: int32
page:
type: object
properties:
totalCount:
description: 总记录数
type: integer
format: int32
pageSize:
description: 每页记录数
type: integer
format: int32
totalPage:
description: 总页数
type: integer
format: int32
currPage:
description: 当前页数
type: integer
format: int32
list:
type: array
items:
$ref: '#/definitions/${className}Entity'
${className}EntityEdit:
type: object
properties:
#foreach ($column in $columns)
$column.attrname:
description: $column.comments
#if($column.toLowerattrType == 'integer')
type: $column.toLowerattrType
format: int64
#elseif($column.toLowerattrType == 'date')
type: string
#else
type: string
#end
#end
${className}Entity:
type: object
properties:
#foreach ($column in $columns)
$column.attrname:
description: $column.comments
#if($column.toLowerattrType == 'integer')
type: $column.toLowerattrType
format: int64
#elseif($column.toLowerattrType == 'date')
type: string
format: date-time
#else
type: string
#end
#end