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

V2: upgrade modulename to v2 #1552

Merged
merged 6 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/swag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"strings"

"github.com/swaggo/swag"
"github.com/swaggo/swag/format"
"github.com/swaggo/swag/gen"
"github.com/swaggo/swag/v2"
"github.com/swaggo/swag/v2/format"
"github.com/swaggo/swag/v2/gen"

"github.com/urfave/cli/v2"
)
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Package swag converts Go annotations to Swagger Documentation 2.0.
See https://github.com/swaggo/swag for more information about swag.
*/
package swag // import "github.com/swaggo/swag"
package swag // import "github.com/swaggo/swag/v2"
2 changes: 1 addition & 1 deletion example/basic/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"net/http"

"github.com/swaggo/swag/example/basic/web"
"github.com/swaggo/swag/v2/example/basic/web"
)

// GetStringByInt example
Expand Down
2 changes: 1 addition & 1 deletion example/basic/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This file was generated by swaggo/swag
package docs

import "github.com/swaggo/swag"
import "github.com/swaggo/swag/v2"

const docTemplate = `{
"schemes": {{ marshal .Schemes }},
Expand Down
2 changes: 1 addition & 1 deletion example/basic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"net/http"

"github.com/swaggo/swag/example/basic/api"
"github.com/swaggo/swag/v2/example/basic/api"
)

// @title Swagger Example API
Expand Down
4 changes: 2 additions & 2 deletions example/celler/controller/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strconv"

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

// ShowAccount godoc
Expand Down
4 changes: 2 additions & 2 deletions example/celler/controller/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/http"

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

// Auth godoc
Expand Down
4 changes: 2 additions & 2 deletions example/celler/controller/bottles.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strconv"

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

// ShowBottle godoc
Expand Down
2 changes: 1 addition & 1 deletion example/celler/controller/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"

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

// PingExample godoc
Expand Down
2 changes: 1 addition & 1 deletion example/celler/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/gofrs/uuid v4.2.0+incompatible
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2
github.com/swaggo/gin-swagger v1.4.2
github.com/swaggo/swag v1.8.1
github.com/swaggo/swag/v2 v2.0.0-beta
)

require (
Expand Down
6 changes: 3 additions & 3 deletions example/celler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/swaggo/swag/example/celler/controller"
_ "github.com/swaggo/swag/example/celler/docs"
"github.com/swaggo/swag/example/celler/httputil"
"github.com/swaggo/swag/v2/example/celler/controller"
_ "github.com/swaggo/swag/v2/example/celler/docs"
"github.com/swaggo/swag/v2/example/celler/httputil"

swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
Expand Down
2 changes: 1 addition & 1 deletion example/markdown/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This file was generated by swaggo/swag
package docs

import "github.com/swaggo/swag"
import "github.com/swaggo/swag/v2"

const docTemplate = `{
"schemes": {{ marshal .Schemes }},
Expand Down
7 changes: 4 additions & 3 deletions example/markdown/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package main

import (
"net/http"

"github.com/gorilla/mux"
httpSwagger "github.com/swaggo/http-swagger"
"github.com/swaggo/swag/example/markdown/api"
_ "github.com/swaggo/swag/example/markdown/docs"
"net/http"
"github.com/swaggo/swag/v2/example/markdown/api"
_ "github.com/swaggo/swag/v2/example/markdown/docs"
)

// @title Swagger Example API
Expand Down
2 changes: 1 addition & 1 deletion example/object-map-example/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This file was generated by swaggo/swag
package docs

import "github.com/swaggo/swag"
import "github.com/swaggo/swag/v2"

const docTemplate = `{
"schemes": {{ marshal .Schemes }},
Expand Down
4 changes: 2 additions & 2 deletions example/object-map-example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package main

import (
"github.com/gin-gonic/gin"
"github.com/swaggo/swag/example/object-map-example/controller"
_ "github.com/swaggo/swag/example/object-map-example/docs"
"github.com/swaggo/swag/v2/example/object-map-example/controller"
_ "github.com/swaggo/swag/v2/example/object-map-example/docs"

swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
Expand Down
2 changes: 1 addition & 1 deletion example/override/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This file was generated by swaggo/swag
package docs

import "github.com/swaggo/swag"
import "github.com/swaggo/swag/v2"

const docTemplate = `{
"schemes": {{ marshal .Schemes }},
Expand Down
2 changes: 1 addition & 1 deletion format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path/filepath"
"strings"

"github.com/swaggo/swag"
"github.com/swaggo/swag/v2"
)

// Format implements `fmt` command for formatting swag comments in Go source
Expand Down
2 changes: 1 addition & 1 deletion format/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var testFiles = map[string][]byte{
import (
"net/http"

"github.com/swaggo/swag/format/testdata/api"
"github.com/swaggo/swag/v2/format/testdata/api"
)

// @title Swagger Example API
Expand Down
2 changes: 1 addition & 1 deletion gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
v2 "github.com/go-openapi/spec"
v3 "github.com/sv-tools/openapi/spec"

"github.com/swaggo/swag"
"github.com/swaggo/swag/v2"
"sigs.k8s.io/yaml"
)

Expand Down
2 changes: 1 addition & 1 deletion gen/gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/swaggo/swag"
"github.com/swaggo/swag/v2"
)

const searchDir = "../testdata/simple"
Expand Down
2 changes: 1 addition & 1 deletion gen/src/oas2.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package docs

import "github.com/swaggo/swag"
import "github.com/swaggo/swag/v2"

const docTemplate{{ if ne .InstanceName "swagger" }}{{ .InstanceName }} {{- end }} = `{{ printDoc .Doc}}`

Expand Down
4 changes: 2 additions & 2 deletions gen/src/oas3.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package docs

import "github.com/swaggo/swag"
import "github.com/swaggo/swag/v2"

const docTemplate{{ if ne .InstanceName "swagger" }}{{ .InstanceName }} {{- end }} = `{{ printDoc .Doc}}`

Expand All @@ -17,4 +17,4 @@ var SwaggerInfo{{ if ne .InstanceName "swagger" }}{{ .InstanceName }} {{- end }}

func init() {
swag.Register(SwaggerInfo{{ if ne .InstanceName "swagger" }}{{ .InstanceName }} {{- end }}.InstanceName(), SwaggerInfo{{ if ne .InstanceName "swagger" }}{{ .InstanceName }} {{- end }})
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/swaggo/swag
module github.com/swaggo/swag/v2

go 1.18

Expand Down
2 changes: 1 addition & 1 deletion golist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestGetAllGoFileInfoFromDepsByList(t *testing.T) {
name: "normal",
buildPackage: &build.Package{
Name: "main",
ImportPath: "github.com/swaggo/swag/testdata/golist",
ImportPath: "github.com/swaggo/swag/v2/testdata/golist",
Dir: "testdata/golist",
GoFiles: []string{"main.go"},
CgoFiles: []string{"api/api.go"},
Expand Down
4 changes: 2 additions & 2 deletions testdata/alias_import/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"log"
"net/http"

"github.com/swaggo/swag/testdata/alias_import/data"
"github.com/swaggo/swag/testdata/alias_type/types"
"github.com/swaggo/swag/v2/testdata/alias_import/data"
"github.com/swaggo/swag/v2/testdata/alias_type/types"
)

// @Summary Get application
Expand Down
2 changes: 1 addition & 1 deletion testdata/alias_import/data/applicationresponse.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package data

import (
typesapplication "github.com/swaggo/swag/testdata/alias_import/types"
typesapplication "github.com/swaggo/swag/v2/testdata/alias_import/types"
)

type ApplicationResponse struct {
Expand Down
2 changes: 1 addition & 1 deletion testdata/alias_import/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package alias_import
import (
"net/http"

"github.com/swaggo/swag/testdata/alias_import/api"
"github.com/swaggo/swag/v2/testdata/alias_import/api"
)

// @title Swagger Example API
Expand Down
2 changes: 1 addition & 1 deletion testdata/alias_type/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"time"

"github.com/swaggo/swag/testdata/alias_type/data"
"github.com/swaggo/swag/v2/testdata/alias_type/data"
)

/*// @Summary Get time as string
Expand Down
3 changes: 2 additions & 1 deletion testdata/alias_type/data/alias.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package data

import (
"github.com/swaggo/swag/testdata/alias_type/types"
"time"

"github.com/swaggo/swag/v2/testdata/alias_type/types"
)

type TimeContainer struct {
Expand Down
2 changes: 1 addition & 1 deletion testdata/alias_type/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package alias_type
import (
"net/http"

"github.com/swaggo/swag/testdata/alias_type/api"
"github.com/swaggo/swag/v2/testdata/alias_type/api"
)

// @title Swagger Example API
Expand Down
3 changes: 2 additions & 1 deletion testdata/code_examples/api/api1.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package api

import (
_ "github.com/swaggo/swag/testdata/conflict_name/model"
"net/http"

_ "github.com/swaggo/swag/v2/testdata/conflict_name/model"
)

// @Description Check if Health of service it's OK!
Expand Down
2 changes: 1 addition & 1 deletion testdata/composition/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package api
import (
"net/http"

"github.com/swaggo/swag/testdata/composition/common"
"github.com/swaggo/swag/v2/testdata/composition/common"
)

type Foo struct {
Expand Down
2 changes: 1 addition & 1 deletion testdata/composition/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package composition
import (
"net/http"

"github.com/swaggo/swag/testdata/composition/api"
"github.com/swaggo/swag/v2/testdata/composition/api"
)

// @title Swagger Example API
Expand Down
3 changes: 2 additions & 1 deletion testdata/conflict_name/api/api1.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package api

import (
_ "github.com/swaggo/swag/testdata/conflict_name/model"
"net/http"

_ "github.com/swaggo/swag/v2/testdata/conflict_name/model"
)

// @Tags Health
Expand Down
3 changes: 2 additions & 1 deletion testdata/conflict_name/api/api2.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package api

import (
_ "github.com/swaggo/swag/testdata/conflict_name/model2"
"net/http"

_ "github.com/swaggo/swag/v2/testdata/conflict_name/model2"
)

// @Tags Health
Expand Down
2 changes: 1 addition & 1 deletion testdata/duplicated/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package composition
import (
"net/http"

"github.com/swaggo/swag/testdata/duplicated/api"
"github.com/swaggo/swag/v2/testdata/duplicated/api"
)

// @title Swagger Example API
Expand Down
2 changes: 1 addition & 1 deletion testdata/duplicated2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package composition
import (
"net/http"

"github.com/swaggo/swag/testdata/duplicated2/api"
"github.com/swaggo/swag/v2/testdata/duplicated2/api"
)

// @title Swagger Example API
Expand Down
4 changes: 2 additions & 2 deletions testdata/duplicated_function_scoped/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package composition
import (
"net/http"

"github.com/swaggo/swag/testdata/duplicated_function_scoped/api"
otherapi "github.com/swaggo/swag/testdata/duplicated_function_scoped/other_api"
"github.com/swaggo/swag/v2/testdata/duplicated_function_scoped/api"
otherapi "github.com/swaggo/swag/v2/testdata/duplicated_function_scoped/other_api"
)

// @title Swagger Example API
Expand Down
2 changes: 1 addition & 1 deletion testdata/enums/api/api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package api

import "github.com/swaggo/swag/testdata/enums/types"
import "github.com/swaggo/swag/v2/testdata/enums/types"

// post students
//
Expand Down
2 changes: 1 addition & 1 deletion testdata/enums/types/model.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types

import (
"github.com/swaggo/swag/testdata/enums/consts"
"github.com/swaggo/swag/v2/testdata/enums/consts"
)

type Class int
Expand Down
Loading