chore: update swag version & change uuid package

This commit is contained in:
henry.chen
2021-11-13 22:20:48 +08:00
parent a5292027c0
commit f6cb55c00f
9 changed files with 111 additions and 112 deletions

View File

@@ -1,14 +1,13 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2021-04-29 11:12:59.387582 +0800 CST m=+0.016433684
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"text/template"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
@@ -16,14 +15,13 @@ var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "This is a sample server celler server.",
"title": "APP Demo API",
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"license": {},
"version": "1.0"
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "/api",
"basePath": "{{.BasePath}}",
"paths": {}
}`
@@ -37,23 +35,40 @@ type swaggerInfo struct {
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{ Schemes: []string{}}
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "APP Demo API",
Description: "This is a sample server celler server.",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface {}) string {
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
"escape": func(v interface{}) string {
// escape tabs
str := strings.Replace(v.(string), "\t", "\\t", -1)
// replace " with \", and if that results in \\", replace that with \\\"
str = strings.Replace(str, "\"", "\\\"", -1)
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, SwaggerInfo); err != nil {
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}

View File

@@ -4,10 +4,8 @@
"description": "This is a sample server celler server.",
"title": "APP Demo API",
"contact": {},
"license": {},
"version": "1.0"
},
"host": "{{.Host}}",
"basePath": "/api",
"paths": {}
}

View File

@@ -1,9 +1,7 @@
basePath: /api
host: '{{.Host}}'
info:
contact: {}
description: This is a sample server celler server.
license: {}
title: APP Demo API
version: "1.0"
paths: {}

View File

@@ -1,14 +1,13 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2021-04-29 11:12:59.414073 +0800 CST m=+0.019228292
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"text/template"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
@@ -16,14 +15,13 @@ var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "This is a sample server celler server.",
"title": "APP Demo API",
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"license": {},
"version": "1.0"
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "/api",
"basePath": "{{.BasePath}}",
"paths": {}
}`
@@ -37,23 +35,40 @@ type swaggerInfo struct {
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{ Schemes: []string{}}
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "APP Demo API",
Description: "This is a sample server celler server.",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface {}) string {
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
"escape": func(v interface{}) string {
// escape tabs
str := strings.Replace(v.(string), "\t", "\\t", -1)
// replace " with \", and if that results in \\", replace that with \\\"
str = strings.Replace(str, "\"", "\\\"", -1)
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, SwaggerInfo); err != nil {
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}

View File

@@ -4,10 +4,8 @@
"description": "This is a sample server celler server.",
"title": "APP Demo API",
"contact": {},
"license": {},
"version": "1.0"
},
"host": "{{.Host}}",
"basePath": "/api",
"paths": {}
}

View File

@@ -1,9 +1,7 @@
basePath: /api
host: '{{.Host}}'
info:
contact: {}
description: This is a sample server celler server.
license: {}
title: APP Demo API
version: "1.0"
paths: {}