Showing the changes to example/basic/api (1 of 10 files). Show all
Unified · Split
| @@ -0,0 +1,40 @@ | ||
| 1 | +package api | |
| 2 | + | |
| 3 | +import ( | |
| 4 | + "fmt" | |
| 5 | + "github.com/gin-gonic/gin" | |
| 6 | + "github.com/swaggo/swag/example/basic/web" | |
| 7 | +) | |
| 8 | + | |
| 9 | +// | |
| 10 | +// @Summary Add a new pet to the store | |
| 11 | +// @Description get string by ID | |
| 12 | +// @Accept json | |
| 13 | +// @Produce json | |
| 14 | +// @Param some_id path int true "Some ID" | |
| 15 | +// @Success 200 {string} string "ok" | |
| 16 | +// @Failure 400 {object} web.APIError "We need ID!!" | |
| 17 | +// @Failure 404 {object} web.APIError "Can not find ID" | |
| 18 | +// @Router /testapi/get-string-by-int/{some_id} [get] | |
| 19 | +func GetStringByInt(c *gin.Context) { | |
| 20 | + err := web.APIError{} | |
| 21 | + fmt.Println(err) | |
| 22 | +} | |
| 23 | + | |
| 24 | +// @Description get struct array by ID | |
| 25 | +// @Accept json | |
| 26 | +// @Produce json | |
| 27 | +// @Param some_id path string true "Some ID" | |
| 28 | +// @Param offset query int true "Offset" | |
| 29 | +// @Param limit query int true "Offset" | |
| 30 | +// @Success 200 {string} string "ok" | |
| 31 | +// @Failure 400 {object} web.APIError "We need ID!!" | |
| 32 | +// @Failure 404 {object} web.APIError "Can not find ID" | |
| 33 | +// @Router /testapi/get-struct-array-by-string/{some_id} [get] | |
| 34 | +func GetStructArrayByString(c *gin.Context) { | |
| 35 | + | |
| 36 | +} | |
| 37 | + | |
| 38 | +type Pet3 struct { | |
| 39 | + ID int `json:"id"` | |
| 40 | +} | |