Skip to content

Commit

Permalink
add gin-swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
eddycjy committed Mar 18, 2018
1 parent 3d2dc94 commit aa3e25b
Show file tree
Hide file tree
Showing 157 changed files with 56,182 additions and 46 deletions.
341 changes: 341 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,341 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2018-03-17 21:41:17.911363936 +0800 CST m=+0.156842263

package docs

import (
"github.com/swaggo/swag"
)

var doc = `{
"swagger": "2.0",
"info": {
"description": "An example of gin",
"title": "Golang Gin API",
"termsOfService": "https://github.com/EDDYCJY/go-gin-example",
"contact": {},
"license": {
"name": "MIT",
"url": "https://github.com/EDDYCJY/go-gin-example/blob/master/LICENSE"
},
"version": "1.0"
},
"basePath": "/v1",
"paths": {
"/api/v1/articles": {
"get": {
"produces": [
"application/json"
],
"summary": "获取多个文章",
"parameters": [
{
"type": "integer",
"description": "TagID",
"name": "tag_id",
"in": "query"
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
},
{
"type": "integer",
"description": "CreatedBy",
"name": "created_by",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":[{\"id\":3,\"created_on\":1516937037,\"modified_on\":0,\"tag_id\":11,\"tag\":{\"id\":11,\"created_on\":1516851591,\"modified_on\":0,\"name\":\"312321\",\"created_by\":\"4555\",\"modified_by\":\"\",\"state\":1},\"content\":\"5555\",\"created_by\":\"2412\",\"modified_by\":\"\",\"state\":1}],\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"summary": "新增文章",
"parameters": [
{
"type": "integer",
"description": "TagID",
"name": "tag_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Title",
"name": "title",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Desc",
"name": "desc",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Content",
"name": "content",
"in": "query",
"required": true
},
{
"type": "string",
"description": "CreatedBy",
"name": "created_by",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/articles/{id}": {
"get": {
"produces": [
"application/json"
],
"summary": "获取单个文章",
"parameters": [
{}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{\"id\":3,\"created_on\":1516937037,\"modified_on\":0,\"tag_id\":11,\"tag\":{\"id\":11,\"created_on\":1516851591,\"modified_on\":0,\"name\":\"312321\",\"created_by\":\"4555\",\"modified_by\":\"\",\"state\":1},\"content\":\"5555\",\"created_by\":\"2412\",\"modified_by\":\"\",\"state\":1},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
},
"put": {
"produces": [
"application/json"
],
"summary": "修改文章",
"parameters": [
{},
{
"type": "string",
"description": "TagID",
"name": "tag_id",
"in": "query"
},
{
"type": "string",
"description": "Title",
"name": "title",
"in": "query"
},
{
"type": "string",
"description": "Desc",
"name": "desc",
"in": "query"
},
{
"type": "string",
"description": "Content",
"name": "content",
"in": "query"
},
{
"type": "string",
"description": "ModifiedBy",
"name": "modified_by",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"code\":400,\"data\":{},\"msg\":\"请求参数错误\"}",
"schema": {
"type": "string"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"summary": "删除文章",
"parameters": [
{}
],
"responses": {
"200": {
"description": "{\"code\":400,\"data\":{},\"msg\":\"请求参数错误\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/tags": {
"get": {
"produces": [
"application/json"
],
"summary": "获取多个文章标签",
"parameters": [
{
"type": "string",
"description": "Name",
"name": "name",
"in": "query"
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{\"lists\":[{\"id\":3,\"created_on\":1516849721,\"modified_on\":0,\"name\":\"3333\",\"created_by\":\"4555\",\"modified_by\":\"\",\"state\":0}],\"total\":29},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"summary": "新增文章标签",
"parameters": [
{
"type": "string",
"description": "Name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
},
{
"type": "integer",
"description": "CreatedBy",
"name": "created_by",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/tags/{id}": {
"put": {
"produces": [
"application/json"
],
"summary": "修改文章标签",
"parameters": [
{},
{
"type": "string",
"description": "ID",
"name": "name",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
},
{
"type": "string",
"description": "ModifiedBy",
"name": "modified_by",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"summary": "删除文章标签",
"parameters": [
{}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
}
}
}`

type s struct{}

func (s *s) ReadDoc() string {
return doc
}
func init() {
swag.Register(swag.Name, &s{})
}
Loading

0 comments on commit aa3e25b

Please sign in to comment.