Skip to content
Permalink
Browse files

fix: unnecessary type field on response objects (#459)

  • Loading branch information...
ubogdan authored and easonlin404 committed Jul 18, 2019
1 parent bd1235d commit d8cb1c8c603708892b487a1322c43639e3d26bf2
@@ -1,14 +1,19 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2018-06-14 10:58:52.298729546 +0800 CST m=+0.030701430
// 2019-07-17 15:34:26.038643394 +0300 EEST m=+0.024553500

package docs

import (
"bytes"
"encoding/json"

"github.com/alecthomas/template"
"github.com/swaggo/swag"
)

var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server.",
@@ -58,14 +63,12 @@ var doc = `{
"400": {
"description": "We need ID!!",
"schema": {
"type": "object",
"$ref": "#/definitions/web.APIError"
}
},
"404": {
"description": "Can not find ID",
"schema": {
"type": "object",
"$ref": "#/definitions/web.APIError"
}
}
@@ -112,14 +115,12 @@ var doc = `{
"400": {
"description": "We need ID!!",
"schema": {
"type": "object",
"$ref": "#/definitions/web.APIError"
}
},
"404": {
"description": "Can not find ID",
"schema": {
"type": "object",
"$ref": "#/definitions/web.APIError"
}
}
@@ -169,14 +170,12 @@ var doc = `{
"400": {
"description": "We need ID!!",
"schema": {
"type": "object",
"$ref": "#/definitions/web.APIError"
}
},
"404": {
"description": "Can not find ID",
"schema": {
"type": "object",
"$ref": "#/definitions/web.APIError"
}
}
@@ -264,11 +263,39 @@ 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{Schemes: []string{}}

type s struct{}

func (s *s) ReadDoc() string {
return doc
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}

var tpl bytes.Buffer
if err := t.Execute(&tpl, SwaggerInfo); err != nil {
return doc
}

return tpl.String()
}

func init() {
swag.Register(swag.Name, &s{})
}

This file was deleted.

0 comments on commit d8cb1c8

Please sign in to comment.
You can’t perform that action at this time.