Skip to content

Commit

Permalink
fix: undefined httputil and model (#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleChuang committed Jan 8, 2022
1 parent 1a87334 commit 8ffc6c2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 14 deletions.
2 changes: 2 additions & 0 deletions example/celler/controller/accounts.go
Expand Up @@ -6,6 +6,8 @@ import (
"strconv"

"github.com/gin-gonic/gin"
"github.com/swaggo/swag/example/celler/httputil"
"github.com/swaggo/swag/example/celler/model"
)

// ShowAccount godoc
Expand Down
69 changes: 55 additions & 14 deletions example/celler/docs/docs.go
@@ -1,6 +1,5 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag

package docs

import (
Expand All @@ -16,7 +15,7 @@ var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
Expand Down Expand Up @@ -801,6 +800,43 @@ var doc = `{
}
}
},
"/examples/post": {
"post": {
"description": "post request example",
"consumes": [
"application/json"
],
"produces": [
"text/plain"
],
"summary": "post request example",
"parameters": [
{
"description": "Account Info",
"name": "message",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.Account"
}
}
],
"responses": {
"200": {
"description": "success",
"schema": {
"type": "string"
}
},
"500": {
"description": "fail",
"schema": {
"type": "string"
}
}
}
}
},
"/examples/securities": {
"get": {
"security": [
Expand Down Expand Up @@ -968,37 +1004,35 @@ var doc = `{
"authorizationUrl": "https://example.com/oauth/authorize",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"admin": " Grants read and write access to administrative information"
"admin": " Grants read and write access to administrative information"
}
},
"OAuth2Application": {
"type": "oauth2",
"flow": "application",
"authorizationUrl": "",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"admin": " Grants read and write access to administrative information",
"write": " Grants write access"
"admin": " Grants read and write access to administrative information",
"write": " Grants write access"
}
},
"OAuth2Implicit": {
"type": "oauth2",
"flow": "implicit",
"authorizationUrl": "https://example.com/oauth/authorize",
"scopes": {
"admin": " Grants read and write access to administrative information",
"write": " Grants write access"
"admin": " Grants read and write access to administrative information",
"write": " Grants write access"
}
},
"OAuth2Password": {
"type": "oauth2",
"flow": "password",
"authorizationUrl": "",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"admin": " Grants read and write access to administrative information",
"read": " Grants read access",
"write": " Grants write access"
"admin": " Grants read and write access to administrative information",
"read": " Grants read access",
"write": " Grants write access"
}
}
}
Expand Down Expand Up @@ -1034,6 +1068,13 @@ func (s *s) ReadDoc() 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
Expand All @@ -1048,5 +1089,5 @@ func (s *s) ReadDoc() string {
}

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

0 comments on commit 8ffc6c2

Please sign in to comment.