Skip to content

Commit

Permalink
V2: upgrade modulename to v2 (#1552)
Browse files Browse the repository at this point in the history
* upgrade modulename to v2

* update tmpl files

* change import paths

* update more import paths

* update more import paths

* fix go.mod

---------

Co-authored-by: Tobias Theel <[email protected]>
  • Loading branch information
Nerzal and Tobias Theel authored Apr 17, 2023
1 parent 21247c7 commit 44b59ad
Show file tree
Hide file tree
Showing 94 changed files with 134 additions and 129 deletions.
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

0 comments on commit 44b59ad

Please sign in to comment.