From 40a37cb51078fbbbe60c193a5c0bc28735c29e5a Mon Sep 17 00:00:00 2001 From: nannan00 <17491932+nannan00@users.noreply.github.com> Date: Tue, 13 Aug 2024 14:31:37 +0800 Subject: [PATCH] Fix model api doc (#304) * fix(apidoc): model api path change to `/api/v1/model` prefix --------- Co-authored-by: kingofzihua --- pkg/api/model/handler/action.go | 6 ++++-- pkg/api/model/handler/instance_selection.go | 6 +++--- pkg/api/model/handler/query.go | 1 + pkg/api/model/handler/resource_type.go | 8 ++++---- pkg/api/model/handler/system.go | 8 ++++---- pkg/api/model/handler/system_config.go | 2 +- pkg/api/model/handler/token.go | 2 +- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pkg/api/model/handler/action.go b/pkg/api/model/handler/action.go index 7f27548f..ba9808b8 100644 --- a/pkg/api/model/handler/action.go +++ b/pkg/api/model/handler/action.go @@ -36,7 +36,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/actions [post] +// @Router /api/v1/model/systems/{system_id}/actions [post] func BatchCreateActions(c *gin.Context) { var body []actionSerializer if err := c.ShouldBindJSON(&body); err != nil { @@ -123,6 +123,7 @@ func BatchCreateActions(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret +// @Router /api/v1/model/systems/{system_id}/actions/{action_id} [put] func UpdateAction(c *gin.Context) { systemID := c.Param("system_id") @@ -255,6 +256,7 @@ func UpdateAction(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret +// @Router /api/v1/model/systems/{system_id}/actions/{action_id} [delete] func DeleteAction(c *gin.Context) { systemID := c.Param("system_id") actionID := c.Param("action_id") @@ -278,7 +280,7 @@ func DeleteAction(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/actions [delete] +// @Router /api/v1/model/systems/{system_id}/actions [delete] func BatchDeleteActions(c *gin.Context) { systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/instance_selection.go b/pkg/api/model/handler/instance_selection.go index 443feb4d..3a9e95bf 100644 --- a/pkg/api/model/handler/instance_selection.go +++ b/pkg/api/model/handler/instance_selection.go @@ -38,7 +38,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/instance-selections [post] +// @Router /api/v1/model/systems/{system_id}/instance-selections [post] func BatchCreateInstanceSelections(c *gin.Context) { var body []instanceSelectionSerializer if err := c.ShouldBindJSON(&body); err != nil { @@ -114,7 +114,7 @@ func BatchCreateInstanceSelections(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/instance-selections/{instance_selection_id} [put] +// @Router /api/v1/model/systems/{system_id}/instance-selections/{instance_selection_id} [put] func UpdateInstanceSelection(c *gin.Context) { systemID := c.Param("system_id") @@ -197,7 +197,7 @@ func UpdateInstanceSelection(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/instance-selections/{instance_selection_id} [delete] +// @Router /api/v1/model/systems/{system_id}/instance-selections/{instance_selection_id} [delete] func DeleteInstanceSelection(c *gin.Context) { systemID := c.Param("system_id") instanceSelectionID := c.Param("instance_selection_id") diff --git a/pkg/api/model/handler/query.go b/pkg/api/model/handler/query.go index d6be5fd2..7c7b1fa2 100644 --- a/pkg/api/model/handler/query.go +++ b/pkg/api/model/handler/query.go @@ -45,6 +45,7 @@ const ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret +// @Router /api/v1/model/systems/{system_id}/query [get] //nolint:gocognit func SystemInfoQuery(c *gin.Context) { var query querySerializer diff --git a/pkg/api/model/handler/resource_type.go b/pkg/api/model/handler/resource_type.go index 22153328..fced03c1 100644 --- a/pkg/api/model/handler/resource_type.go +++ b/pkg/api/model/handler/resource_type.go @@ -38,7 +38,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types [post] +// @Router /api/v1/model/systems/{system_id}/resource-types [post] func BatchCreateResourceTypes(c *gin.Context) { var body []resourceTypeSerializer if err := c.ShouldBindJSON(&body); err != nil { @@ -117,7 +117,7 @@ func BatchCreateResourceTypes(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types/{resource_type_id} [put] +// @Router /api/v1/model/systems/{system_id}/resource-types/{resource_type_id} [put] func UpdateResourceType(c *gin.Context) { systemID := c.Param("system_id") @@ -219,7 +219,7 @@ func UpdateResourceType(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types/{resource_type_id} [delete] +// @Router /api/v1/model/systems/{system_id}/resource-types/{resource_type_id} [delete] func DeleteResourceType(c *gin.Context) { systemID := c.Param("system_id") resourceTypeID := c.Param("resource_type_id") @@ -242,7 +242,7 @@ func DeleteResourceType(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/resource-types [delete] +// @Router /api/v1/model/systems/{system_id}/resource-types [delete] func BatchDeleteResourceTypes(c *gin.Context) { systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/system.go b/pkg/api/model/handler/system.go index 4ef62814..ae832295 100644 --- a/pkg/api/model/handler/system.go +++ b/pkg/api/model/handler/system.go @@ -50,7 +50,7 @@ func defaultValidClients(c *gin.Context, originClients string) string { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems [post] +// @Router /api/v1/model/systems [post] func CreateSystem(c *gin.Context) { // validate the body var body systemSerializer @@ -122,7 +122,7 @@ func CreateSystem(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id} [put] +// @Router /api/v1/model/systems/{system_id} [put] func UpdateSystem(c *gin.Context) { systemID := c.Param("system_id") @@ -210,7 +210,7 @@ func UpdateSystem(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id} [get] +// @Router /api/v1/model/systems/{system_id} [get] func GetSystem(c *gin.Context) { // validate the body systemID := c.Param("system_id") @@ -253,7 +253,7 @@ func GetSystem(c *gin.Context) { // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/clients [get] +// @Router /api/v1/model/systems/{system_id}/clients [get] func GetSystemClients(c *gin.Context) { // validate the body systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/system_config.go b/pkg/api/model/handler/system_config.go index a3ef3fb6..8f9d5200 100644 --- a/pkg/api/model/handler/system_config.go +++ b/pkg/api/model/handler/system_config.go @@ -49,7 +49,7 @@ const ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/configs/{name} [POST] +// @Router /api/v1/model/systems/{system_id}/configs/{name} [POST] func CreateOrUpdateConfigDispatch(c *gin.Context) { systemID := c.Param("system_id") diff --git a/pkg/api/model/handler/token.go b/pkg/api/model/handler/token.go index afbe5649..d262f87e 100644 --- a/pkg/api/model/handler/token.go +++ b/pkg/api/model/handler/token.go @@ -32,7 +32,7 @@ import ( // @Header 200 {string} X-Request-Id "the request id" // @Security AppCode // @Security AppSecret -// @Router /api/v1/systems/{system_id}/token [get] +// @Router /api/v1/model/systems/{system_id}/token [get] func GetToken(c *gin.Context) { // validate the body systemID := c.Param("system_id")