From e5752486283162262c5d3c67088c5e829484ea59 Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Fri, 6 Sep 2024 09:06:41 +0900 Subject: [PATCH] Add OperationalIds to API doc --- api/docs.go | 10 ++++++++++ api/swagger.json | 10 ++++++++++ api/swagger.yaml | 10 ++++++++++ pkg/api/rest/controller/migration.go | 3 +++ pkg/api/rest/controller/recommendation.go | 1 + pkg/api/rest/controller/sample.go | 6 ++++++ 6 files changed, 40 insertions(+) diff --git a/api/docs.go b/api/docs.go index e687596..7bf9ae4 100644 --- a/api/docs.go +++ b/api/docs.go @@ -71,6 +71,7 @@ const docTemplate = `{ "[Migration] Infrastructure" ], "summary": "Migrate an infrastructure to the multi-cloud infrastructure (MCI)", + "operationId": "MigrateInfra", "parameters": [ { "type": "string", @@ -125,6 +126,7 @@ const docTemplate = `{ "[Migration] Infrastructure" ], "summary": "Get the migrated multi-cloud infrastructure (MCI)", + "operationId": "GetInfra", "parameters": [ { "type": "string", @@ -176,6 +178,7 @@ const docTemplate = `{ "[Migration] Infrastructure" ], "summary": "Delete the migrated mult-cloud infrastructure (MCI)", + "operationId": "DeleteInfra", "parameters": [ { "type": "string", @@ -258,6 +261,7 @@ const docTemplate = `{ "[Recommendation] Infrastructure" ], "summary": "Recommend an appropriate multi-cloud infrastructure (MCI) for cloud migration", + "operationId": "RecommendInfra", "parameters": [ { "description": "Specify the your infrastructure to be migrated", @@ -304,6 +308,7 @@ const docTemplate = `{ "[Sample API] Users" ], "summary": "Get a list of users", + "operationId": "GetUsers", "responses": { "200": { "description": "(sample) This is a sample description for success response in Swagger UI", @@ -331,6 +336,7 @@ const docTemplate = `{ "[Sample API] Users" ], "summary": "Create a new user", + "operationId": "CreateUser", "parameters": [ { "description": "User information", @@ -371,6 +377,7 @@ const docTemplate = `{ "[Sample API] Users" ], "summary": "Get specific user information", + "operationId": "GetUser", "parameters": [ { "type": "integer", @@ -407,6 +414,7 @@ const docTemplate = `{ "[Sample API] Users" ], "summary": "Update a user", + "operationId": "UpdateUser", "parameters": [ { "type": "integer", @@ -452,6 +460,7 @@ const docTemplate = `{ "[Sample API] Users" ], "summary": "Delete a user", + "operationId": "DeleteUser", "parameters": [ { "type": "integer", @@ -494,6 +503,7 @@ const docTemplate = `{ "[Sample API] Users" ], "summary": "Patch a user", + "operationId": "PatchUser", "parameters": [ { "type": "integer", diff --git a/api/swagger.json b/api/swagger.json index 633cc71..3aa1c0f 100644 --- a/api/swagger.json +++ b/api/swagger.json @@ -64,6 +64,7 @@ "[Migration] Infrastructure" ], "summary": "Migrate an infrastructure to the multi-cloud infrastructure (MCI)", + "operationId": "MigrateInfra", "parameters": [ { "type": "string", @@ -118,6 +119,7 @@ "[Migration] Infrastructure" ], "summary": "Get the migrated multi-cloud infrastructure (MCI)", + "operationId": "GetInfra", "parameters": [ { "type": "string", @@ -169,6 +171,7 @@ "[Migration] Infrastructure" ], "summary": "Delete the migrated mult-cloud infrastructure (MCI)", + "operationId": "DeleteInfra", "parameters": [ { "type": "string", @@ -251,6 +254,7 @@ "[Recommendation] Infrastructure" ], "summary": "Recommend an appropriate multi-cloud infrastructure (MCI) for cloud migration", + "operationId": "RecommendInfra", "parameters": [ { "description": "Specify the your infrastructure to be migrated", @@ -297,6 +301,7 @@ "[Sample API] Users" ], "summary": "Get a list of users", + "operationId": "GetUsers", "responses": { "200": { "description": "(sample) This is a sample description for success response in Swagger UI", @@ -324,6 +329,7 @@ "[Sample API] Users" ], "summary": "Create a new user", + "operationId": "CreateUser", "parameters": [ { "description": "User information", @@ -364,6 +370,7 @@ "[Sample API] Users" ], "summary": "Get specific user information", + "operationId": "GetUser", "parameters": [ { "type": "integer", @@ -400,6 +407,7 @@ "[Sample API] Users" ], "summary": "Update a user", + "operationId": "UpdateUser", "parameters": [ { "type": "integer", @@ -445,6 +453,7 @@ "[Sample API] Users" ], "summary": "Delete a user", + "operationId": "DeleteUser", "parameters": [ { "type": "integer", @@ -487,6 +496,7 @@ "[Sample API] Users" ], "summary": "Patch a user", + "operationId": "PatchUser", "parameters": [ { "type": "integer", diff --git a/api/swagger.yaml b/api/swagger.yaml index dd41af4..7cb392e 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -710,6 +710,7 @@ paths: consumes: - application/json description: Migrate an infrastructure to the multi-cloud infrastructure (MCI) + operationId: MigrateInfra parameters: - default: mig01 description: Namespace ID @@ -747,6 +748,7 @@ paths: consumes: - application/json description: Delete the migrated mult-cloud infrastructure (MCI) + operationId: DeleteInfra parameters: - default: mig01 description: Namespace ID @@ -783,6 +785,7 @@ paths: consumes: - application/json description: Get the migrated multi-cloud infrastructure (MCI) + operationId: GetInfra parameters: - default: mig01 description: Namespace ID @@ -839,6 +842,7 @@ paths: - application/json description: Recommend an appropriate multi-cloud infrastructure (MCI) for cloud migration + operationId: RecommendInfra parameters: - description: Specify the your infrastructure to be migrated in: body @@ -870,6 +874,7 @@ paths: consumes: - application/json description: Get information of all users. + operationId: GetUsers produces: - application/json responses: @@ -889,6 +894,7 @@ paths: consumes: - application/json description: Create a new user with the given information. + operationId: CreateUser parameters: - description: User information in: body @@ -916,6 +922,7 @@ paths: consumes: - application/json description: Delete a user with the given information. + operationId: DeleteUser parameters: - description: User ID in: path @@ -944,6 +951,7 @@ paths: consumes: - application/json description: Get information of a user with a specific ID. + operationId: GetUser parameters: - description: User ID in: path @@ -969,6 +977,7 @@ paths: consumes: - application/json description: Patch a user with the given information. + operationId: PatchUser parameters: - description: User ID in: path @@ -1004,6 +1013,7 @@ paths: consumes: - application/json description: Update a user with the given information. + operationId: UpdateUser parameters: - description: User ID in: path diff --git a/pkg/api/rest/controller/migration.go b/pkg/api/rest/controller/migration.go index 3128c50..27feba3 100644 --- a/pkg/api/rest/controller/migration.go +++ b/pkg/api/rest/controller/migration.go @@ -40,6 +40,7 @@ type MigrateInfraResponse struct { } // MigrateInfra godoc +// @ID MigrateInfra // @Summary Migrate an infrastructure to the multi-cloud infrastructure (MCI) // @Description Migrate an infrastructure to the multi-cloud infrastructure (MCI) // @Tags [Migration] Infrastructure @@ -97,6 +98,7 @@ func MigrateInfra(c echo.Context) error { } // GetInfra godoc +// @ID GetInfra // @Summary Get the migrated multi-cloud infrastructure (MCI) // @Description Get the migrated multi-cloud infrastructure (MCI) // @Tags [Migration] Infrastructure @@ -150,6 +152,7 @@ func GetInfra(c echo.Context) error { } // DeleteInfra godoc +// @ID DeleteInfra // @Summary Delete the migrated mult-cloud infrastructure (MCI) // @Description Delete the migrated mult-cloud infrastructure (MCI) // @Tags [Migration] Infrastructure diff --git a/pkg/api/rest/controller/recommendation.go b/pkg/api/rest/controller/recommendation.go index f8c3914..6e5df6d 100644 --- a/pkg/api/rest/controller/recommendation.go +++ b/pkg/api/rest/controller/recommendation.go @@ -46,6 +46,7 @@ type RecommendInfraResponse struct { } // RecommendInfra godoc +// @ID RecommendInfra // @Summary Recommend an appropriate multi-cloud infrastructure (MCI) for cloud migration // @Description Recommend an appropriate multi-cloud infrastructure (MCI) for cloud migration // @Tags [Recommendation] Infrastructure diff --git a/pkg/api/rest/controller/sample.go b/pkg/api/rest/controller/sample.go index 3aeeb33..bebd6d8 100644 --- a/pkg/api/rest/controller/sample.go +++ b/pkg/api/rest/controller/sample.go @@ -29,6 +29,7 @@ type GetUsersResponse struct { } // GetUsers godoc +// @ID GetUsers // @Summary Get a list of users // @Description Get information of all users. // @Tags [Sample API] Users @@ -58,6 +59,7 @@ type GetUserResponse struct { } // GetUser godoc +// @ID GetUser // @Summary Get specific user information // @Description Get information of a user with a specific ID. // @Tags [Sample API] Users @@ -96,6 +98,7 @@ type CreateUserResponse struct { } // CreateUser godoc +// @ID CreateUser // @Summary Create a new user // @Description Create a new user with the given information. // @Tags [Sample API] Users @@ -130,6 +133,7 @@ type UpdateUserResponse struct { } // UpdateUser godoc +// @ID UpdateUser // @Summary Update a user // @Description Update a user with the given information. // @Tags [Sample API] Users @@ -170,6 +174,7 @@ type PatchUserResponse struct { } // PatchUser godoc +// @ID PatchUser // @Summary Patch a user // @Description Patch a user with the given information. // @Tags [Sample API] Users @@ -205,6 +210,7 @@ func PatchUser(c echo.Context) error { // No ResponseBody required for "DELETE /users/{id}" // DeleteUser godoc +// @ID DeleteUser // @Summary Delete a user // @Description Delete a user with the given information. // @Tags [Sample API] Users