feat: base: upgrade swagger
This commit is contained in:
90
docs/docs.go
90
docs/docs.go
@@ -2,16 +2,9 @@
|
||||
// This file was generated by swaggo/swag
|
||||
package docs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"text/template"
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
"github.com/swaggo/swag"
|
||||
)
|
||||
|
||||
var doc = `{
|
||||
const docTemplate_swagger = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
@@ -25,6 +18,9 @@ var doc = `{
|
||||
"paths": {
|
||||
"/statistics/china": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -53,6 +49,9 @@ var doc = `{
|
||||
},
|
||||
"/statistics/city/{sort}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -98,6 +97,9 @@ var doc = `{
|
||||
},
|
||||
"/statistics/country": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -129,6 +131,9 @@ var doc = `{
|
||||
},
|
||||
"/statistics/country/child": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -158,12 +163,15 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/statistics/provience/{sort}": {
|
||||
"/statistics/province/{sort}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
"summary": "provience statistics",
|
||||
"summary": "province statistics",
|
||||
"parameters": [
|
||||
{
|
||||
"enum": [
|
||||
@@ -374,56 +382,18 @@ var doc = `{
|
||||
}
|
||||
}`
|
||||
|
||||
type swaggerInfo struct {
|
||||
Version string
|
||||
Host string
|
||||
BasePath string
|
||||
Schemes []string
|
||||
Title string
|
||||
Description string
|
||||
}
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = swaggerInfo{
|
||||
Version: "1.0",
|
||||
Host: "",
|
||||
BasePath: "",
|
||||
Schemes: []string{},
|
||||
Title: "nCov Tracker",
|
||||
Description: "",
|
||||
}
|
||||
|
||||
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 {
|
||||
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, sInfo); err != nil {
|
||||
return doc
|
||||
}
|
||||
|
||||
return tpl.String()
|
||||
// SwaggerInfo_swagger holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo_swagger = &swag.Spec{
|
||||
Version: "1.0",
|
||||
Host: "",
|
||||
BasePath: "",
|
||||
Schemes: []string{},
|
||||
Title: "nCov Tracker",
|
||||
Description: "",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate_swagger,
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register("swagger", &s{})
|
||||
swag.Register(SwaggerInfo_swagger.InstanceName(), SwaggerInfo_swagger)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
"paths": {
|
||||
"/statistics/china": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -36,6 +39,9 @@
|
||||
},
|
||||
"/statistics/city/{sort}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -81,6 +87,9 @@
|
||||
},
|
||||
"/statistics/country": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -112,6 +121,9 @@
|
||||
},
|
||||
"/statistics/country/child": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
@@ -141,12 +153,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/statistics/provience/{sort}": {
|
||||
"/statistics/province/{sort}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Statistics"
|
||||
],
|
||||
"summary": "provience statistics",
|
||||
"summary": "province statistics",
|
||||
"parameters": [
|
||||
{
|
||||
"enum": [
|
||||
|
||||
@@ -115,6 +115,8 @@ info:
|
||||
paths:
|
||||
/statistics/china:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -140,6 +142,8 @@ paths:
|
||||
in: path
|
||||
name: sort
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -157,6 +161,8 @@ paths:
|
||||
- Statistics
|
||||
/statistics/country:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -174,6 +180,8 @@ paths:
|
||||
- Statistics
|
||||
/statistics/country/child:
|
||||
get:
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -189,7 +197,7 @@ paths:
|
||||
summary: country statistics
|
||||
tags:
|
||||
- Statistics
|
||||
/statistics/provience/{sort}:
|
||||
/statistics/province/{sort}:
|
||||
get:
|
||||
parameters:
|
||||
- description: data sorted by
|
||||
@@ -201,6 +209,8 @@ paths:
|
||||
in: path
|
||||
name: sort
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -213,7 +223,7 @@ paths:
|
||||
$ref: '#/definitions/models.AreaInfo'
|
||||
type: array
|
||||
type: object
|
||||
summary: provience statistics
|
||||
summary: province statistics
|
||||
tags:
|
||||
- Statistics
|
||||
swagger: "2.0"
|
||||
|
||||
Reference in New Issue
Block a user