Skip to content

Commit

Permalink
Merge pull request #122 from seokho-son/main
Browse files Browse the repository at this point in the history
Add OperationID to API docs
  • Loading branch information
yunkon-kim authored Sep 6, 2024
2 parents e07348a + e575248 commit 62260f1
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const docTemplate = `{
"[Migration] Infrastructure"
],
"summary": "Migrate an infrastructure to the multi-cloud infrastructure (MCI)",
"operationId": "MigrateInfra",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -125,6 +126,7 @@ const docTemplate = `{
"[Migration] Infrastructure"
],
"summary": "Get the migrated multi-cloud infrastructure (MCI)",
"operationId": "GetInfra",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -176,6 +178,7 @@ const docTemplate = `{
"[Migration] Infrastructure"
],
"summary": "Delete the migrated mult-cloud infrastructure (MCI)",
"operationId": "DeleteInfra",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -331,6 +336,7 @@ const docTemplate = `{
"[Sample API] Users"
],
"summary": "Create a new user",
"operationId": "CreateUser",
"parameters": [
{
"description": "User information",
Expand Down Expand Up @@ -371,6 +377,7 @@ const docTemplate = `{
"[Sample API] Users"
],
"summary": "Get specific user information",
"operationId": "GetUser",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -407,6 +414,7 @@ const docTemplate = `{
"[Sample API] Users"
],
"summary": "Update a user",
"operationId": "UpdateUser",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -452,6 +460,7 @@ const docTemplate = `{
"[Sample API] Users"
],
"summary": "Delete a user",
"operationId": "DeleteUser",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -494,6 +503,7 @@ const docTemplate = `{
"[Sample API] Users"
],
"summary": "Patch a user",
"operationId": "PatchUser",
"parameters": [
{
"type": "integer",
Expand Down
10 changes: 10 additions & 0 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"[Migration] Infrastructure"
],
"summary": "Migrate an infrastructure to the multi-cloud infrastructure (MCI)",
"operationId": "MigrateInfra",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -118,6 +119,7 @@
"[Migration] Infrastructure"
],
"summary": "Get the migrated multi-cloud infrastructure (MCI)",
"operationId": "GetInfra",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -169,6 +171,7 @@
"[Migration] Infrastructure"
],
"summary": "Delete the migrated mult-cloud infrastructure (MCI)",
"operationId": "DeleteInfra",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -324,6 +329,7 @@
"[Sample API] Users"
],
"summary": "Create a new user",
"operationId": "CreateUser",
"parameters": [
{
"description": "User information",
Expand Down Expand Up @@ -364,6 +370,7 @@
"[Sample API] Users"
],
"summary": "Get specific user information",
"operationId": "GetUser",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -400,6 +407,7 @@
"[Sample API] Users"
],
"summary": "Update a user",
"operationId": "UpdateUser",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -445,6 +453,7 @@
"[Sample API] Users"
],
"summary": "Delete a user",
"operationId": "DeleteUser",
"parameters": [
{
"type": "integer",
Expand Down Expand Up @@ -487,6 +496,7 @@
"[Sample API] Users"
],
"summary": "Patch a user",
"operationId": "PatchUser",
"parameters": [
{
"type": "integer",
Expand Down
10 changes: 10 additions & 0 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -747,6 +748,7 @@ paths:
consumes:
- application/json
description: Delete the migrated mult-cloud infrastructure (MCI)
operationId: DeleteInfra
parameters:
- default: mig01
description: Namespace ID
Expand Down Expand Up @@ -783,6 +785,7 @@ paths:
consumes:
- application/json
description: Get the migrated multi-cloud infrastructure (MCI)
operationId: GetInfra
parameters:
- default: mig01
description: Namespace ID
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -870,6 +874,7 @@ paths:
consumes:
- application/json
description: Get information of all users.
operationId: GetUsers
produces:
- application/json
responses:
Expand All @@ -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
Expand Down Expand Up @@ -916,6 +922,7 @@ paths:
consumes:
- application/json
description: Delete a user with the given information.
operationId: DeleteUser
parameters:
- description: User ID
in: path
Expand Down Expand Up @@ -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
Expand All @@ -969,6 +977,7 @@ paths:
consumes:
- application/json
description: Patch a user with the given information.
operationId: PatchUser
parameters:
- description: User ID
in: path
Expand Down Expand Up @@ -1004,6 +1013,7 @@ paths:
consumes:
- application/json
description: Update a user with the given information.
operationId: UpdateUser
parameters:
- description: User ID
in: path
Expand Down
3 changes: 3 additions & 0 deletions pkg/api/rest/controller/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/api/rest/controller/recommendation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/rest/controller/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 62260f1

Please sign in to comment.