-
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.
Merge pull request #662 from MaitreDede/feat/cgo
feat: Skip cgo package
- Loading branch information
Showing
4 changed files
with
113 additions
and
0 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,19 @@ | ||
package api | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
// @Summary Add a new pet to the store | ||
// @Description get string by ID | ||
// @ID get-string-by-int | ||
// @Accept json | ||
// @Produce json | ||
// @Param some_id path int true "Some ID" Format(int64) | ||
// @Param some_id body int true "Some ID" | ||
// @Success 200 {string} string "ok" | ||
// @Failure 400 {object} string "We need ID!!" | ||
// @Failure 404 {object} string "Can not find ID" | ||
// @Router /testapi/get-string-by-int/{some_id} [get] | ||
func GetStringByInt(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,64 @@ | ||
package main | ||
|
||
/* | ||
#include <stdio.h> | ||
void Hello(){ | ||
printf("Hello world\n"); | ||
} | ||
*/ | ||
import "C" | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/swaggo/swag/testdata/simple_cgo/api" | ||
) | ||
|
||
// @title Swagger Example API | ||
// @version 1.0 | ||
// @description This is a sample server Petstore server. | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @contact.name API Support | ||
// @contact.url http://www.swagger.io/support | ||
// @contact.email [email protected] | ||
|
||
// @license.name Apache 2.0 | ||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||
|
||
// @host petstore.swagger.io | ||
// @BasePath /v2 | ||
|
||
// @securityDefinitions.basic BasicAuth | ||
|
||
// @securityDefinitions.apikey ApiKeyAuth | ||
// @in header | ||
// @name Authorization | ||
|
||
// @securitydefinitions.oauth2.application OAuth2Application | ||
// @tokenUrl https://example.com/oauth/token | ||
// @scope.write Grants write access | ||
// @scope.admin Grants read and write access to administrative information | ||
|
||
// @securitydefinitions.oauth2.implicit OAuth2Implicit | ||
// @authorizationurl https://example.com/oauth/authorize | ||
// @scope.write Grants write access | ||
// @scope.admin Grants read and write access to administrative information | ||
|
||
// @securitydefinitions.oauth2.password OAuth2Password | ||
// @tokenUrl https://example.com/oauth/token | ||
// @scope.read Grants read access | ||
// @scope.write Grants write access | ||
// @scope.admin Grants read and write access to administrative information | ||
|
||
// @securitydefinitions.oauth2.accessCode OAuth2AccessCode | ||
// @tokenUrl https://example.com/oauth/token | ||
// @authorizationurl https://example.com/oauth/authorize | ||
// @scope.admin Grants read and write access to administrative information | ||
func main() { | ||
C.Hello() | ||
|
||
r := gin.New() | ||
r.GET("/testapi/get-string-by-int/:some_id", api.GetStringByInt) | ||
r.Run() | ||
} |