Skip to content

Commit 4f0f6db

Browse files
add support swaggo v2
1 parent c9c2b32 commit 4f0f6db

14 files changed

Lines changed: 787 additions & 33 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ var SwaggerInfo_swagger = &swag.Spec{
4141

4242
func init() {
4343
swag.Register(SwaggerInfo_swagger.InstanceName(), SwaggerInfo_swagger)
44-
}
44+
}

‎example/v2/go.mod‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module github.com/swaggo/echo-swagger/example/v2
2+
3+
go 1.17
4+
5+
replace github.com/swaggo/echo-swagger => ../../
6+
7+
require (
8+
github.com/labstack/echo/v4 v4.13.3
9+
github.com/swaggo/echo-swagger v0.0.0-00010101000000-000000000000
10+
github.com/swaggo/swag v1.16.2
11+
)
12+
13+
require (
14+
github.com/KyleBanks/depth v1.2.1 // indirect
15+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
16+
github.com/go-openapi/jsonreference v0.20.2 // indirect
17+
github.com/go-openapi/spec v0.20.9 // indirect
18+
github.com/go-openapi/swag v0.22.3 // indirect
19+
github.com/josharian/intern v1.0.0 // indirect
20+
github.com/labstack/gommon v0.4.2 // indirect
21+
github.com/mailru/easyjson v0.7.7 // indirect
22+
github.com/mattn/go-colorable v0.1.13 // indirect
23+
github.com/mattn/go-isatty v0.0.20 // indirect
24+
github.com/pkg/errors v0.9.1 // indirect
25+
github.com/sv-tools/openapi v0.2.1 // indirect
26+
github.com/swaggo/files/v2 v2.0.0 // indirect
27+
github.com/swaggo/swag/v2 v2.0.0-rc4 // indirect
28+
github.com/valyala/bytebufferpool v1.0.0 // indirect
29+
github.com/valyala/fasttemplate v1.2.2 // indirect
30+
golang.org/x/crypto v0.31.0 // indirect
31+
golang.org/x/net v0.33.0 // indirect
32+
golang.org/x/sys v0.28.0 // indirect
33+
golang.org/x/text v0.21.0 // indirect
34+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
35+
gopkg.in/yaml.v2 v2.4.0 // indirect
36+
gopkg.in/yaml.v3 v3.0.1 // indirect
37+
sigs.k8s.io/yaml v1.3.0 // indirect
38+
)

‎example/v2/go.sum‎

Lines changed: 214 additions & 0 deletions
Large diffs are not rendered by default.

example/main.go renamed to example/v2/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package main
22

33
import (
44
"github.com/labstack/echo/v4"
5-
"github.com/swaggo/echo-swagger"
6-
_ "github.com/swaggo/echo-swagger/example/docs" // docs is generated by Swag CLI, you have to import it.
5+
echoSwagger "github.com/swaggo/echo-swagger"
6+
_ "github.com/swaggo/echo-swagger/example/v2/docs" // docs is generated by Swag CLI, you have to import it.
77
)
88

99
// @title Swagger Example API

‎example/v3/docs/docs.go‎

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎example/v3/docs/swagger.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"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":{}}

‎example/v3/docs/swagger.yaml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
basePath: /v2
2+
host: petstore.swagger.io
3+
info:
4+
contact:
5+
email: support@swagger.io
6+
name: API Support
7+
url: http://www.swagger.io/support
8+
description: This is a sample server Petstore server.
9+
license:
10+
name: Apache 2.0
11+
url: http://www.apache.org/licenses/LICENSE-2.0.html
12+
termsOfService: http://swagger.io/terms/
13+
title: Swagger Example API
14+
version: "1.0"
15+
paths: {}
16+
swagger: "2.0"

‎example/v3/go.mod‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module github.com/swaggo/echo-swagger/example/v3
2+
3+
go 1.17
4+
5+
replace github.com/swaggo/echo-swagger => ../../
6+
7+
require (
8+
github.com/labstack/echo/v4 v4.13.3
9+
github.com/swaggo/echo-swagger v0.0.0-00010101000000-000000000000
10+
github.com/swaggo/swag/v2 v2.0.0-rc4
11+
)
12+
13+
require (
14+
github.com/KyleBanks/depth v1.2.1 // indirect
15+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
16+
github.com/go-openapi/jsonreference v0.20.2 // indirect
17+
github.com/go-openapi/spec v0.20.9 // indirect
18+
github.com/go-openapi/swag v0.22.3 // indirect
19+
github.com/josharian/intern v1.0.0 // indirect
20+
github.com/labstack/gommon v0.4.2 // indirect
21+
github.com/mailru/easyjson v0.7.7 // indirect
22+
github.com/mattn/go-colorable v0.1.13 // indirect
23+
github.com/mattn/go-isatty v0.0.20 // indirect
24+
github.com/pkg/errors v0.9.1 // indirect
25+
github.com/sv-tools/openapi v0.2.1 // indirect
26+
github.com/swaggo/files/v2 v2.0.0 // indirect
27+
github.com/swaggo/swag v1.16.2 // indirect
28+
github.com/valyala/bytebufferpool v1.0.0 // indirect
29+
github.com/valyala/fasttemplate v1.2.2 // indirect
30+
golang.org/x/crypto v0.31.0 // indirect
31+
golang.org/x/net v0.33.0 // indirect
32+
golang.org/x/sys v0.28.0 // indirect
33+
golang.org/x/text v0.21.0 // indirect
34+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
35+
gopkg.in/yaml.v2 v2.4.0 // indirect
36+
gopkg.in/yaml.v3 v3.0.1 // indirect
37+
sigs.k8s.io/yaml v1.3.0 // indirect
38+
)

0 commit comments

Comments
 (0)
⌂ 换网址