Skip to content

Commit

Permalink
Fix model api doc (#304)
Browse files Browse the repository at this point in the history
* fix(apidoc): model api path change to `/api/v1/model` prefix
---------

Co-authored-by: kingofzihua <[email protected]>
  • Loading branch information
nannan00 and kingofzihua authored Aug 13, 2024
1 parent eb9a155 commit 40a37cb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
6 changes: 4 additions & 2 deletions pkg/api/model/handler/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand All @@ -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")

Expand Down
6 changes: 3 additions & 3 deletions pkg/api/model/handler/instance_selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions pkg/api/model/handler/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/model/handler/resource_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand All @@ -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")

Expand Down
8 changes: 4 additions & 4 deletions pkg/api/model/handler/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/model/handler/system_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/model/handler/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 40a37cb

Please sign in to comment.