Skip to content

Commit

Permalink
fix: Linter fails (#1136) (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilinux committed Feb 17, 2022
1 parent 1a0a57a commit cd97e7f
Show file tree
Hide file tree
Showing 18 changed files with 272 additions and 151 deletions.
4 changes: 2 additions & 2 deletions example/basic/docs/docs.go
Expand Up @@ -4,7 +4,7 @@ package docs

import "github.com/swaggo/swag"

const docTemplate_swagger = `{
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
Expand Down Expand Up @@ -263,7 +263,7 @@ var SwaggerInfo = &swag.Spec{
Title: "Swagger Example API",
Description: "This is a sample server Petstore server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate_swagger,
SwaggerTemplate: docTemplate,
}

func init() {
Expand Down
1 change: 0 additions & 1 deletion example/basic/docs/swagger/swagger.yaml
Expand Up @@ -109,7 +109,6 @@ paths:
required: true
schema:
$ref: '#/definitions/web.Pet'
type: object
produces:
- application/json
responses:
Expand Down
4 changes: 2 additions & 2 deletions example/celler/docs/docs.go
Expand Up @@ -4,7 +4,7 @@ package docs

import "github.com/swaggo/swag"

const docTemplate_swagger = `{
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
Expand Down Expand Up @@ -1040,7 +1040,7 @@ var SwaggerInfo = &swag.Spec{
Title: "Swagger Example API",
Description: "This is a sample server celler server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate_swagger,
SwaggerTemplate: docTemplate,
}

func init() {
Expand Down
55 changes: 40 additions & 15 deletions example/celler/docs/swagger/swagger.yaml
Expand Up @@ -48,7 +48,6 @@ definitions:
properties:
account:
$ref: '#/definitions/model.Account'
type: object
id:
example: 1
type: integer
Expand Down Expand Up @@ -122,7 +121,6 @@ paths:
required: true
schema:
$ref: '#/definitions/model.AddAccount'
type: object
produces:
- application/json
responses:
Expand All @@ -142,7 +140,7 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Add a account
summary: Add an account
tags:
- accounts
/accounts/{id}:
Expand Down Expand Up @@ -176,7 +174,7 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Update a account
summary: Delete an account
tags:
- accounts
get:
Expand Down Expand Up @@ -208,7 +206,7 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Show a account
summary: Show an account
tags:
- accounts
patch:
Expand All @@ -227,7 +225,6 @@ paths:
required: true
schema:
$ref: '#/definitions/model.UpdateAccount'
type: object
produces:
- application/json
responses:
Expand All @@ -247,7 +244,7 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Update a account
summary: Update an account
tags:
- accounts
/accounts/{id}/images:
Expand Down Expand Up @@ -590,6 +587,30 @@ paths:
summary: ping example
tags:
- example
/examples/post:
post:
consumes:
- application/json
description: post request example
parameters:
- description: Account Info
in: body
name: message
required: true
schema:
$ref: '#/definitions/model.Account'
produces:
- text/plain
responses:
"200":
description: success
schema:
type: string
"500":
description: fail
schema:
type: string
summary: post request example
/examples/securities:
get:
consumes:
Expand Down Expand Up @@ -639,29 +660,33 @@ securityDefinitions:
authorizationUrl: https://example.com/oauth/authorize
flow: accessCode
scopes:
admin: ' Grants read and write access to administrative information'
admin: ' Grants read and write access to administrative
information'
tokenUrl: https://example.com/oauth/token
type: oauth2
OAuth2Application:
flow: application
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'
tokenUrl: https://example.com/oauth/token
type: oauth2
OAuth2Implicit:
authorizationUrl: https://example.com/oauth/authorize
flow: implicit
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'
type: oauth2
OAuth2Password:
flow: password
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'
tokenUrl: https://example.com/oauth/token
type: oauth2
swagger: "2.0"
44 changes: 44 additions & 0 deletions example/go-module-support/docs/docs.go
@@ -0,0 +1,44 @@
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs

import "github.com/swaggo/swag"

const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {}
}`

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "petstore.swagger.io",
BasePath: "/v2",
Schemes: []string{},
Title: "Swagger Example API",
Description: "This is a sample server Petstore server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}

func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}
21 changes: 21 additions & 0 deletions example/go-module-support/docs/swagger.json
@@ -0,0 +1,21 @@
{
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server.",
"title": "Swagger Example API",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "petstore.swagger.io",
"basePath": "/v2",
"paths": {}
}
16 changes: 16 additions & 0 deletions example/go-module-support/docs/swagger.yaml
@@ -0,0 +1,16 @@
basePath: /v2
host: petstore.swagger.io
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: This is a sample server Petstore server.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: Swagger Example API
version: "1.0"
paths: {}
swagger: "2.0"
17 changes: 15 additions & 2 deletions example/go-module-support/go.mod
Expand Up @@ -5,21 +5,34 @@ go 1.17
require (
github.com/gin-gonic/gin v1.7.7
github.com/swaggo/examples v0.0.0-20190624100559-f57286ab550c
github.com/swaggo/swag v1.7.9
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/golang/protobuf v1.3.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.9 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/sys v0.0.0-20210423082822-04245dca01da // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

0 comments on commit cd97e7f

Please sign in to comment.