-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add operationId uniqueness check (#732)
* Add operationId uniqueness check. * Fix test * Fix linter rules * Move operationsIds map and function to local scope Co-authored-by: Eason Lin <[email protected]> Co-authored-by: sdghchj <[email protected]>
- Loading branch information
1 parent
c5fb1a1
commit 366e536
Showing
4 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package api | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
// @Description get Foo | ||
// @ID get-foo | ||
// @Success 200 {string} string | ||
// @Router /testapi/get-foo [get] | ||
func GetFoo(c *gin.Context) {} | ||
|
||
// @Description post Bar | ||
// @ID get-foo | ||
// @Success 200 {string} string | ||
// @Router /testapi/post-bar [post] | ||
func PostBar(c *gin.Context) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package composition | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
|
||
"github.com/swaggo/swag/testdata/duplicated/api" | ||
) | ||
|
||
// @title Swagger Example API | ||
// @version 1.0 | ||
// @description This is a sample server | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @host petstore.swagger.io | ||
// @BasePath /v2 | ||
|
||
func main() { | ||
r := gin.New() | ||
r.GET("/testapi/get-foo", api.GetFoo) | ||
r.POST("/testapi/post-bar", api.PostBar) | ||
r.Run() | ||
} |