From 82df0758dd00f1265cec4d68353baeae04457c7a Mon Sep 17 00:00:00 2001 From: Tucker Gary Siegel <tgsiegel@terpmail.umd.edu> Date: Thu, 16 Mar 2023 15:26:42 -0400 Subject: [PATCH] update swagger documentation --- controllers/gdd_controller.go | 18 ++++++++++++------ main.go | 6 ++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/controllers/gdd_controller.go b/controllers/gdd_controller.go index 2c74ba3..fbf3267 100644 --- a/controllers/gdd_controller.go +++ b/controllers/gdd_controller.go @@ -12,19 +12,25 @@ import ( var GetGddValues = services.GetGddValues // GetDailyGdd godoc +<<<<<<< controllers/gdd_controller.go +// @Summary Get GDD Values for given year +// @Tags Gdd, public +// @Security ApiKeyAuth +======= // @Summary Get gdd values // @Tags Gdd, public // @Description get gdd values +>>>>>>> controllers/gdd_controller.go // @Accept json // @Produce json // @Success 200 {object} models.GddResponse // @Failure 400 {object} errors.StandardError // @Param year query int true "Year to get gdd for" -// @Param product query string true "Crop to calculate gdd for" Enums(corn, soybean, sunflower, tomato, sugar_beet, peanut, cotton, potato, wheat, pea, oat, spring_wheat, rice, sorghum) +// @Param product query string true "Crop to calculate gdd for" Enums(corn) // @Param latitude query number true "Latitude to search for" // @Param longitude query number true "Longitude to search for" // @Param accumulate query boolean true "Accumulate gdd values" -// @Param plantingDate query string true "Plant date, ISO8601 or RFC3339 format" +// @Param plantingDate query string true "Plant date RFC3339 format" // @Router /gdd/daily [get] func GetDailyGdd(c *fiber.Ctx) error { ctx := common.DawnCtx{FiberCtx: c} @@ -33,14 +39,14 @@ func GetDailyGdd(c *fiber.Ctx) error { } // GetNormalGdd godoc -// @Summary Get gdd normals -// @Tags Gdd -// @Description get gdd normals +// @Summary Get GDD normals over the past 30 years +// @Tags Gdd, public +// @Security ApiKeyAuth // @Accept json // @Produce json // @Success 200 {object} models.GddResponse // @Failure 400 {object} errors.StandardError -// @Param product query string true "Crop to calculate gdd for" Enums(corn, soybean, sunflower, tomato, sugar_beet, peanut, cotton, potato, wheat, pea, oat, spring_wheat, rice, sorghum) +// @Param product query string true "Crop to calculate gdd for" Enums(corn) // @Param latitude query number true "Latitude to search for" // @Param longitude query number true "Longitude to search for" // @Param accumulate query boolean true "Accumulate gdd values" diff --git a/main.go b/main.go index d91aba7..b0791fc 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,12 @@ import ( "gitlab.cs.umd.edu/dawn/go-backend/dawn-gdd/cmd" ) +// @title Dawn GDD Service +// @contact.name API Support +// @contact.email tgsiegel@umd.edu +// @securityDefinitions.apikey ApiKeyAuth +// @in header +// @name Authorization func main() { cmd.Execute() } -- GitLab