refactor: fix swagger doc issues

This commit is contained in:
dineshsalunke
2024-01-17 20:10:13 +05:30
parent 937c027dd8
commit f5688db55c
5 changed files with 307 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ package structs
import "time" import "time"
// swagger:model
type NewProjectPayload struct { type NewProjectPayload struct {
// required:true // required:true
Title string `json:"title" binding:"Required"` Title string `json:"title" binding:"Required"`
@@ -15,6 +16,7 @@ type NewProjectPayload struct {
Description string `json:"description"` Description string `json:"description"`
} }
// swagger:model
type UpdateProjectPayload struct { type UpdateProjectPayload struct {
// required:true // required:true
Title string `json:"title" binding:"Required"` Title string `json:"title" binding:"Required"`

View File

@@ -21,7 +21,7 @@ func ListProjectBoards(ctx *context.APIContext) {
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - name: id // - name: projectId
// in: path // in: path
// description: id of the project // description: id of the project
// type: string // type: string
@@ -78,7 +78,7 @@ func CreateProjectBoard(ctx *context.APIContext) {
// consumes: // consumes:
// - application/json // - application/json
// parameters: // parameters:
// - name: id // - name: projectId
// in: path // in: path
// description: id of the project // description: id of the project
// type: string // type: string
@@ -128,7 +128,7 @@ func GetProjectBoard(ctx *context.APIContext) {
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - name: id // - name: boardId
// in: path // in: path
// description: id of the board // description: id of the board
// type: string // type: string
@@ -164,7 +164,7 @@ func UpdateProjectBoard(ctx *context.APIContext) {
// consumes: // consumes:
// - application/json // - application/json
// parameters: // parameters:
// - name: id // - name: boardId
// in: path // in: path
// description: id of the project board // description: id of the project board
// type: string // type: string
@@ -219,7 +219,7 @@ func DeleteProjectBoard(ctx *context.APIContext) {
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - name: id // - name: boardId
// in: path // in: path
// description: id of the project board // description: id of the project board
// type: string // type: string

View File

@@ -143,7 +143,7 @@ func GetProject(ctx *context.APIContext) {
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - name: id // - name: projectId
// in: path // in: path
// description: id of the project // description: id of the project
// type: string // type: string
@@ -177,7 +177,7 @@ func UpdateProject(ctx *context.APIContext) {
// consumes: // consumes:
// - application/json // - application/json
// parameters: // parameters:
// - name: id // - name: projectId
// in: path // in: path
// description: id of the project // description: id of the project
// type: string // type: string
@@ -223,7 +223,7 @@ func DeleteProject(ctx *context.APIContext) {
// --- // ---
// summary: Delete project // summary: Delete project
// parameters: // parameters:
// - name: id // - name: projectId
// in: path // in: path
// description: id of the project // description: id of the project
// type: string // type: string

View File

@@ -190,4 +190,16 @@ type swaggerParameterBodies struct {
// in:body // in:body
CreateOrUpdateSecretOption api.CreateOrUpdateSecretOption CreateOrUpdateSecretOption api.CreateOrUpdateSecretOption
// in:body
NewProjectPayload api.NewProjectPayload
// in:body
UpdateProjectPayload api.UpdateProjectPayload
// in:body
NewProjectBoardPayload api.NewProjectBoardPayload
// in:body
UpdateProjectBoardPayload api.UpdateProjectBoardPayload
} }

View File

@@ -3027,7 +3027,77 @@
} }
} }
}, },
"/projects/{id}": { "/projects/boards/{boardId}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"board"
],
"summary": "Get project board",
"operationId": "boardGetProjectBoard",
"parameters": [
{
"type": "string",
"description": "id of the board",
"name": "boardId",
"in": "path",
"required": true
}
]
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"board"
],
"summary": "Delete project board",
"operationId": "boardDeleteProjectBoard",
"parameters": [
{
"type": "string",
"description": "id of the project board",
"name": "boardId",
"in": "path",
"required": true
}
]
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"board"
],
"summary": "Update project board",
"operationId": "boardUpdateProjectBoard",
"parameters": [
{
"type": "string",
"description": "id of the project board",
"name": "boardId",
"in": "path",
"required": true
},
{
"name": "board",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UpdateProjectBoardPayload"
}
}
]
}
},
"/projects/{projectId}": {
"get": { "get": {
"produces": [ "produces": [
"application/json" "application/json"
@@ -3041,7 +3111,7 @@
{ {
"type": "string", "type": "string",
"description": "id of the project", "description": "id of the project",
"name": "id", "name": "projectId",
"in": "path", "in": "path",
"required": true "required": true
} }
@@ -3057,7 +3127,7 @@
{ {
"type": "string", "type": "string",
"description": "id of the project", "description": "id of the project",
"name": "id", "name": "projectId",
"in": "path", "in": "path",
"required": true "required": true
} }
@@ -3079,7 +3149,7 @@
{ {
"type": "string", "type": "string",
"description": "id of the project", "description": "id of the project",
"name": "id", "name": "projectId",
"in": "path", "in": "path",
"required": true "required": true
}, },
@@ -3094,6 +3164,69 @@
] ]
} }
}, },
"/projects/{projectId}/boards": {
"get": {
"produces": [
"application/json"
],
"tags": [
"board"
],
"summary": "Get project boards",
"operationId": "boardGetProjectBoards",
"parameters": [
{
"type": "string",
"description": "id of the project",
"name": "projectId",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "page number of results to return (1-based)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "page size of results",
"name": "limit",
"in": "query"
}
]
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"board"
],
"summary": "Create project board",
"operationId": "boardCreateProjectBoard",
"parameters": [
{
"type": "string",
"description": "id of the project",
"name": "projectId",
"in": "path",
"required": true
},
{
"name": "board",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/NewProjectBoardPayload"
}
}
]
}
},
"/repos/issues/search": { "/repos/issues/search": {
"get": { "get": {
"produces": [ "produces": [
@@ -21119,6 +21252,60 @@
}, },
"x-go-package": "code.gitea.io/gitea/modules/structs" "x-go-package": "code.gitea.io/gitea/modules/structs"
}, },
"NewProjectBoardPayload": {
"type": "object",
"required": [
"title"
],
"properties": {
"Sorting": {
"type": "integer",
"format": "int8"
},
"color": {
"type": "string",
"x-go-name": "Color"
},
"default": {
"type": "boolean",
"x-go-name": "Default"
},
"title": {
"type": "string",
"x-go-name": "Title"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"NewProjectPayload": {
"type": "object",
"required": [
"title",
"board_type",
"card_type"
],
"properties": {
"board_type": {
"type": "integer",
"format": "uint8",
"x-go-name": "BoardType"
},
"card_type": {
"type": "integer",
"format": "uint8",
"x-go-name": "CardType"
},
"description": {
"type": "string",
"x-go-name": "Description"
},
"title": {
"type": "string",
"x-go-name": "Title"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"NodeInfo": { "NodeInfo": {
"description": "NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks", "description": "NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks",
"type": "object", "type": "object",
@@ -21719,6 +21906,9 @@
"type": "boolean", "type": "boolean",
"x-go-name": "IsClosed" "x-go-name": "IsClosed"
}, },
"owner": {
"$ref": "#/definitions/User"
},
"repository": { "repository": {
"$ref": "#/definitions/RepositoryMeta" "$ref": "#/definitions/RepositoryMeta"
}, },
@@ -21734,6 +21924,50 @@
}, },
"x-go-package": "code.gitea.io/gitea/modules/structs" "x-go-package": "code.gitea.io/gitea/modules/structs"
}, },
"ProjectBoard": {
"type": "object",
"properties": {
"color": {
"type": "string",
"x-go-name": "Color"
},
"created_at": {
"type": "string",
"format": "date-time",
"x-go-name": "Created"
},
"creator": {
"$ref": "#/definitions/User"
},
"default": {
"type": "boolean",
"x-go-name": "Default"
},
"id": {
"type": "integer",
"format": "int64",
"x-go-name": "ID"
},
"project": {
"$ref": "#/definitions/Project"
},
"sorting": {
"type": "integer",
"format": "int8",
"x-go-name": "Sorting"
},
"title": {
"type": "string",
"x-go-name": "Title"
},
"updated_at": {
"type": "string",
"format": "date-time",
"x-go-name": "Updated"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"PublicKey": { "PublicKey": {
"description": "PublicKey publickey is a user key to push code to repository", "description": "PublicKey publickey is a user key to push code to repository",
"type": "object", "type": "object",
@@ -23111,6 +23345,37 @@
}, },
"x-go-package": "code.gitea.io/gitea/modules/structs" "x-go-package": "code.gitea.io/gitea/modules/structs"
}, },
"UpdateProjectBoardPayload": {
"type": "object",
"properties": {
"color": {
"type": "string",
"x-go-name": "Color"
},
"title": {
"type": "string",
"x-go-name": "Title"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"UpdateProjectPayload": {
"type": "object",
"required": [
"title"
],
"properties": {
"description": {
"type": "string",
"x-go-name": "Description"
},
"title": {
"type": "string",
"x-go-name": "Title"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"UpdateRepoAvatarOption": { "UpdateRepoAvatarOption": {
"description": "UpdateRepoAvatarUserOption options when updating the repo avatar", "description": "UpdateRepoAvatarUserOption options when updating the repo avatar",
"type": "object", "type": "object",
@@ -24058,6 +24323,21 @@
"$ref": "#/definitions/Project" "$ref": "#/definitions/Project"
} }
}, },
"ProjectBoard": {
"description": "ProjectBoard",
"schema": {
"$ref": "#/definitions/ProjectBoard"
}
},
"ProjectBoardList": {
"description": "ProjectBoardList",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/ProjectBoard"
}
}
},
"ProjectList": { "ProjectList": {
"description": "ProjectList", "description": "ProjectList",
"schema": { "schema": {
@@ -24462,7 +24742,7 @@
"parameterBodies": { "parameterBodies": {
"description": "parameterBodies", "description": "parameterBodies",
"schema": { "schema": {
"$ref": "#/definitions/CreateOrUpdateSecretOption" "$ref": "#/definitions/UpdateProjectBoardPayload"
} }
}, },
"redirect": { "redirect": {