Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Linter fails (#1136) #1137

Merged
merged 3 commits into from Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 docTemplateswagger = `{
"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: docTemplateswagger,
}

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 docTemplateswagger = `{
"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: docTemplateswagger,
}

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 docTemplateswagger = `{
"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: docTemplateswagger,
}

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"
2 changes: 1 addition & 1 deletion example/markdown/api.md
Expand Up @@ -4,4 +4,4 @@

In order to re-generate the documentation you need to run

`swago init --md .`
`swag init --md .`
2 changes: 1 addition & 1 deletion example/markdown/api/api.go
Expand Up @@ -16,7 +16,7 @@ type User struct {
type UsersCollection []User

// Error example
type Error struct {
type APIError struct {
ErrorCode int
ErrorMessage string
CreatedAt time.Time
Expand Down