Skip to content

Commit

Permalink
Merge pull request #285 from actiontech/issue332-2
Browse files Browse the repository at this point in the history
API Definition: modify Swagger comments
  • Loading branch information
sjjian authored Jul 19, 2024
2 parents 90abb95 + 6e5ef9a commit dd0bccf
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 80 deletions.
40 changes: 15 additions & 25 deletions api/dms/service/v1/db_service_sync_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ type ListDBServiceSyncTasksReply struct {
base.GenericResp
}

// swagger:parameters GetDBServiceSyncTask
type ListDBServiceSyncTask struct {
DBServiceSyncTask
UID string `json:"uid"`

// last sync error message
LastSyncErr string `json:"last_sync_err"`
LastSyncSuccessTime *time.Time `json:"last_sync_success_time"`
}

type GetDBServiceSyncTaskReq struct {
// Required: true
// in:path
// swagger:ignore
DBServiceSyncTaskUid string `param:"db_service_sync_task_uid" json:"db_service_sync_task_uid" validate:"required"`
}

Expand All @@ -37,14 +44,6 @@ type GetDBServiceSyncTask struct {
UID string `json:"uid"`
}

type ListDBServiceSyncTask struct {
DBServiceSyncTask
UID string `json:"uid"`

// last sync error message
LastSyncErr string `json:"last_sync_err"`
LastSyncSuccessTime *time.Time `json:"last_sync_success_time"`
}

type DBServiceSyncTask struct {
// name
Expand Down Expand Up @@ -74,10 +73,8 @@ type DBServiceSyncTask struct {
SQLEConfig *dmsCommonV1.SQLEConfig `json:"sqle_config"`
}


// swagger:parameters AddDBServiceSyncTask
// swagger:model AddDBServiceSyncTaskReq
type AddDBServiceSyncTaskReq struct {
// in:body
DBServiceSyncTask DBServiceSyncTask `json:"db_service_sync_task"`
}

Expand All @@ -93,20 +90,15 @@ type AddDBServiceSyncTaskReply struct {
base.GenericResp
}

// swagger:parameters UpdateDBServiceSyncTask
// swagger:model UpdateDBServiceSyncTaskReq
type UpdateDBServiceSyncTaskReq struct {
// Required: true
// in:path
// swagger:ignore
DBServiceSyncTaskUid string `param:"db_service_sync_task_uid" json:"db_service_sync_task_uid" validate:"required"`
// Required: true
// in:body
DBServiceSyncTask DBServiceSyncTask `json:"db_service_sync_task" validate:"required"`
}

// swagger:parameters DeleteDBServiceSyncTask
type DeleteDBServiceSyncTaskReq struct {
// Required: true
// in:path
// swagger:ignore
DBServiceSyncTaskUid string `param:"db_service_sync_task_uid" json:"db_service_sync_task_uid" validate:"required"`
}

Expand All @@ -125,9 +117,7 @@ type DBServiceSyncTaskTip struct {
Params pkgParams.Params `json:"params,omitempty"`
}

// swagger:parameters SyncDBServices
type SyncDBServicesReq struct {
// Required: true
// in:path
// swagger:ignore
DBServiceSyncTaskUid string `param:"db_service_sync_task_uid" json:"db_service_sync_task_uid" validate:"required"`
}
41 changes: 30 additions & 11 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,19 +733,20 @@
"operationId": "AddDBServiceSyncTask",
"parameters": [
{
"x-go-name": "DBServiceSyncTask",
"description": "Add new db service sync task",
"name": "db_service_sync_task",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DBServiceSyncTask"
"$ref": "#/definitions/AddDBServiceSyncTaskReq"
}
}
],
"responses": {
"200": {
"description": "AddDBServiceSyncTaskReply",
"description": "AddDBServiceReply",
"schema": {
"$ref": "#/definitions/AddDBServiceSyncTaskReply"
"$ref": "#/definitions/AddDBServiceReply"
}
},
"default": {
Expand Down Expand Up @@ -790,7 +791,7 @@
"parameters": [
{
"type": "string",
"x-go-name": "DBServiceSyncTaskUid",
"description": "db service sync task uid",
"name": "db_service_sync_task_uid",
"in": "path",
"required": true
Expand Down Expand Up @@ -820,18 +821,18 @@
"parameters": [
{
"type": "string",
"x-go-name": "DBServiceSyncTaskUid",
"description": "db service sync task uid",
"name": "db_service_sync_task_uid",
"in": "path",
"required": true
},
{
"x-go-name": "DBServiceSyncTask",
"description": "update db service sync task",
"name": "db_service_sync_task",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DBServiceSyncTask"
"$ref": "#/definitions/UpdateDBServiceSyncTaskReq"
}
}
],
Expand Down Expand Up @@ -859,7 +860,7 @@
"parameters": [
{
"type": "string",
"x-go-name": "DBServiceSyncTaskUid",
"description": "db service sync task uid",
"name": "db_service_sync_task_uid",
"in": "path",
"required": true
Expand Down Expand Up @@ -891,7 +892,7 @@
"parameters": [
{
"type": "string",
"x-go-name": "DBServiceSyncTaskUid",
"description": "db service sync task uid",
"name": "db_service_sync_task_uid",
"in": "path",
"required": true
Expand Down Expand Up @@ -4771,6 +4772,15 @@
},
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"AddDBServiceSyncTaskReq": {
"type": "object",
"properties": {
"db_service_sync_task": {
"$ref": "#/definitions/DBServiceSyncTask"
}
},
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"AddDataExportTaskReply": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -9938,7 +9948,7 @@
"x-go-name": "Uid"
}
},
"x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"UpdateCompanyNotice": {
"description": "A companynotice",
Expand Down Expand Up @@ -10113,6 +10123,15 @@
},
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"UpdateDBServiceSyncTaskReq": {
"type": "object",
"properties": {
"db_service_sync_task": {
"$ref": "#/definitions/DBServiceSyncTask"
}
},
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"UpdateDatabaseSourceServiceReq": {
"type": "object",
"properties": {
Expand Down
47 changes: 30 additions & 17 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ definitions:
x-go-name: Message
type: object
x-go-package: github.com/actiontech/dms/api/dms/service/v1
AddDBServiceSyncTaskReq:
properties:
db_service_sync_task:
$ref: '#/definitions/DBServiceSyncTask'
type: object
x-go-package: github.com/actiontech/dms/api/dms/service/v1
AddDataExportTaskReply:
properties:
code:
Expand Down Expand Up @@ -4113,7 +4119,7 @@ definitions:
type: string
x-go-name: Uid
type: object
x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1
x-go-package: github.com/actiontech/dms/api/dms/service/v1
UpdateCompanyNotice:
description: A companynotice
properties:
Expand Down Expand Up @@ -4245,6 +4251,12 @@ definitions:
$ref: '#/definitions/UpdateDBService'
type: object
x-go-package: github.com/actiontech/dms/api/dms/service/v1
UpdateDBServiceSyncTaskReq:
properties:
db_service_sync_task:
$ref: '#/definitions/DBServiceSyncTask'
type: object
x-go-package: github.com/actiontech/dms/api/dms/service/v1
UpdateDatabaseSourceServiceReq:
properties:
database_source_service:
Expand Down Expand Up @@ -5203,16 +5215,17 @@ paths:
post:
operationId: AddDBServiceSyncTask
parameters:
- in: body
- description: Add new db service sync task
in: body
name: db_service_sync_task
required: true
schema:
$ref: '#/definitions/DBServiceSyncTask'
x-go-name: DBServiceSyncTask
$ref: '#/definitions/AddDBServiceSyncTaskReq'
responses:
"200":
description: AddDBServiceSyncTaskReply
description: AddDBServiceReply
schema:
$ref: '#/definitions/AddDBServiceSyncTaskReply'
$ref: '#/definitions/AddDBServiceReply'
default:
description: GenericResp
schema:
Expand All @@ -5224,11 +5237,11 @@ paths:
delete:
operationId: DeleteDBServiceSyncTask
parameters:
- in: path
- description: db service sync task uid
in: path
name: db_service_sync_task_uid
required: true
type: string
x-go-name: DBServiceSyncTaskUid
responses:
"200":
description: GenericResp
Expand All @@ -5244,11 +5257,11 @@ paths:
get:
operationId: GetDBServiceSyncTask
parameters:
- in: path
- description: db service sync task uid
in: path
name: db_service_sync_task_uid
required: true
type: string
x-go-name: DBServiceSyncTaskUid
responses:
"200":
description: GetDBServiceSyncTaskReply
Expand All @@ -5264,17 +5277,17 @@ paths:
put:
operationId: UpdateDBServiceSyncTask
parameters:
- in: path
- description: db service sync task uid
in: path
name: db_service_sync_task_uid
required: true
type: string
x-go-name: DBServiceSyncTaskUid
- in: body
- description: update db service sync task
in: body
name: db_service_sync_task
required: true
schema:
$ref: '#/definitions/DBServiceSyncTask'
x-go-name: DBServiceSyncTask
$ref: '#/definitions/UpdateDBServiceSyncTaskReq'
responses:
"200":
description: GenericResp
Expand All @@ -5291,11 +5304,11 @@ paths:
post:
operationId: SyncDBServices
parameters:
- in: path
- description: db service sync task uid
in: path
name: db_service_sync_task_uid
required: true
type: string
x-go-name: DBServiceSyncTaskUid
responses:
"200":
description: GenericResp
Expand Down
Loading

0 comments on commit dd0bccf

Please sign in to comment.