Skip to content

Commit

Permalink
feat: add tags example (#101)
Browse files Browse the repository at this point in the history
* add tags example

* add format func
  • Loading branch information
pei0804 authored and easonlin404 committed Apr 22, 2018
1 parent 7abef30 commit e5d83e9
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/basic/docs/docs.go
@@ -1,6 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2018-04-12 11:40:37.756883272 +0800 CST m=+0.033069507
// 2018-04-14 12:21:15.695519809 +0900 JST m=+0.026253845

package docs

Expand Down
8 changes: 7 additions & 1 deletion example/celler/controller/accounts.go
Expand Up @@ -13,6 +13,7 @@ import (
// ShowAccount godoc
// @Summary Show a account
// @Description get string by ID
// @Tags accounts
// @Accept json
// @Produce json
// @Param id path int true "Account ID"
Expand All @@ -39,9 +40,10 @@ func (c *Controller) ShowAccount(ctx *gin.Context) {
// ListAccounts godoc
// @Summary List accounts
// @Description get accounts
// @Tags accounts
// @Accept json
// @Produce json
// @Param q query string false "name search by q"
// @Param q query string false "name search by q" Format(email)
// @Success 200 {array} model.Account
// @Failure 400 {object} httputil.HTTPError
// @Failure 404 {object} httputil.HTTPError
Expand All @@ -60,6 +62,7 @@ func (c *Controller) ListAccounts(ctx *gin.Context) {
// AddAccount godoc
// @Summary Add a account
// @Description add by json account
// @Tags accounts
// @Accept json
// @Produce json
// @Param account body model.AddAccount true "Add account"
Expand Down Expand Up @@ -93,6 +96,7 @@ func (c *Controller) AddAccount(ctx *gin.Context) {
// UpdateAccount godoc
// @Summary Update a account
// @Description Update by json account
// @Tags accounts
// @Accept json
// @Produce json
// @Param id path int true "Account ID"
Expand Down Expand Up @@ -129,6 +133,7 @@ func (c *Controller) UpdateAccount(ctx *gin.Context) {
// DeleteAccount godoc
// @Summary Update a account
// @Description Delete by account ID
// @Tags accounts
// @Accept json
// @Produce json
// @Param id path int true "Account ID" Format(int64)
Expand All @@ -155,6 +160,7 @@ func (c *Controller) DeleteAccount(ctx *gin.Context) {
// UploadAccountImage godoc
// @Summary Upload account image
// @Description Upload file
// @Tags accounts
// @Accept multipart/form-data
// @Produce json
// @Param id path int true "Account ID"
Expand Down
1 change: 1 addition & 0 deletions example/celler/controller/admin.go
Expand Up @@ -13,6 +13,7 @@ import (
// Auth godoc
// @Summary Auth admin
// @Description get admin info
// @Tags accounts,admin
// @Accept json
// @Produce json
// @Success 200 {object} model.Admin
Expand Down
2 changes: 2 additions & 0 deletions example/celler/controller/bottles.go
Expand Up @@ -13,6 +13,7 @@ import (
// @Summary Show a bottle
// @Description get string by ID
// @ID get-string-by-int
// @Tags bottles
// @Accept json
// @Produce json
// @Param id path int true "Bottle ID"
Expand All @@ -39,6 +40,7 @@ func (c *Controller) ShowBottle(ctx *gin.Context) {
// ListBottles godoc
// @Summary List bottles
// @Description get bottles
// @Tags bottles
// @Accept json
// @Produce json
// @Success 200 {array} model.Bottle
Expand Down
6 changes: 6 additions & 0 deletions example/celler/controller/examples.go
Expand Up @@ -12,6 +12,7 @@ import (
// PingExample godoc
// @Summary ping example
// @Description do ping
// @Tags example
// @Accept json
// @Produce json
// @Success 200 {string} string "pong"
Expand All @@ -27,6 +28,7 @@ func (c *Controller) PingExample(ctx *gin.Context) {
// CalcExample godoc
// @Summary calc example
// @Description plus
// @Tags example
// @Accept json
// @Produce json
// @Param val1 query int true "used for calc"
Expand Down Expand Up @@ -54,6 +56,7 @@ func (c *Controller) CalcExample(ctx *gin.Context) {
// PathParamsExample godoc
// @Summary path params example
// @Description path params
// @Tags example
// @Accept json
// @Produce json
// @Param group_id path int true "Group ID"
Expand All @@ -80,6 +83,7 @@ func (c *Controller) PathParamsExample(ctx *gin.Context) {
// HeaderExample godoc
// @Summary custome header example
// @Description custome header
// @Tags example
// @Accept json
// @Produce json
// @Param Authorization header string true "Authentication header"
Expand All @@ -95,6 +99,7 @@ func (c *Controller) HeaderExample(ctx *gin.Context) {
// SecuritiesExample godoc
// @Summary custome header example
// @Description custome header
// @Tags example
// @Accept json
// @Produce json
// @Param Authorization header string true "Authentication header"
Expand All @@ -111,6 +116,7 @@ func (c *Controller) SecuritiesExample(ctx *gin.Context) {
// AttributeExample godoc
// @Summary attribute example
// @Description attribute
// @Tags example
// @Accept json
// @Produce json
// @Param enumstring query string false "string enums" Enums(A, B, C)
Expand Down
47 changes: 47 additions & 0 deletions example/celler/docs/docs.go
@@ -1,5 +1,6 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at

// 2018-04-20 08:32:32.14347006 +0900 JST m=+0.053749461

package docs
Expand Down Expand Up @@ -37,6 +38,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "List accounts",
"parameters": [
{
Expand Down Expand Up @@ -88,6 +92,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Add a account",
"parameters": [
{
Expand Down Expand Up @@ -142,6 +149,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Show a account",
"parameters": [
{
Expand Down Expand Up @@ -191,6 +201,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Update a account",
"parameters": [
{
Expand Down Expand Up @@ -241,6 +254,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Update a account",
"parameters": [
{
Expand Down Expand Up @@ -302,6 +318,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"accounts"
],
"summary": "Upload account image",
"parameters": [
{
Expand Down Expand Up @@ -365,6 +384,10 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"accounts",
"admin"
],
"summary": "Auth admin",
"responses": {
"200": {
Expand Down Expand Up @@ -414,6 +437,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"bottles"
],
"summary": "List bottles",
"responses": {
"200": {
Expand Down Expand Up @@ -458,6 +484,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"bottles"
],
"summary": "Show a bottle",
"operationId": "get-string-by-int",
"parameters": [
Expand Down Expand Up @@ -510,6 +539,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"example"
],
"summary": "attribute example",
"parameters": [
{
Expand Down Expand Up @@ -606,6 +638,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"example"
],
"summary": "calc example",
"parameters": [
{
Expand Down Expand Up @@ -660,6 +695,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"example"
],
"summary": "path params example",
"parameters": [
{
Expand Down Expand Up @@ -714,6 +752,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"example"
],
"summary": "custome header example",
"parameters": [
{
Expand Down Expand Up @@ -761,6 +802,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"example"
],
"summary": "ping example",
"responses": {
"200": {
Expand Down Expand Up @@ -810,6 +854,9 @@ var doc = `{
"produces": [
"application/json"
],
"tags": [
"example"
],
"summary": "custome header example",
"parameters": [
{
Expand Down

0 comments on commit e5d83e9

Please sign in to comment.