summaryrefslogtreecommitdiffstats
path: root/modules/structs/repo_file.go
diff options
context:
space:
mode:
authorDenys Konovalov <kontakt@denyskon.de>2023-06-07 17:49:58 +0200
committerGitHub <noreply@github.com>2023-06-07 23:49:58 +0800
commiteac1bddb8da2e26a3f6d6678b9888c65418cf318 (patch)
tree7e004c97853bc03c780cdf511ff58ec58498d690 /modules/structs/repo_file.go
parent027014d7de19a566cde306c868a31895903d00d5 (diff)
downloadgitea-eac1bddb8da2e26a3f6d6678b9888c65418cf318.tar.gz
gitea-eac1bddb8da2e26a3f6d6678b9888c65418cf318.zip
fix swagger documentation for multiple files API endpoint (#25110)v1.20.0-rc0
Fixes some issues with the swagger documentation for the new multiple files API endpoint (#24887) which were overlooked when submitting the original PR: 1. add some missing parameter descriptions 2. set correct `required` option for required parameters 3. change endpoint description to match it full functionality (every kind of file modification is supported, not just creating and updating)
Diffstat (limited to 'modules/structs/repo_file.go')
-rw-r--r--modules/structs/repo_file.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/structs/repo_file.go b/modules/structs/repo_file.go
index 6ca0e1c101..48fcebe6f8 100644
--- a/modules/structs/repo_file.go
+++ b/modules/structs/repo_file.go
@@ -71,11 +71,11 @@ type ChangeFileOperation struct {
// enum: create,update,delete
Operation string `json:"operation" binding:"Required"`
// path to the existing or new file
- Path string `json:"path" binding:"MaxSize(500)"`
- // content must be base64 encoded
// required: true
+ Path string `json:"path" binding:"Required;MaxSize(500)"`
+ // new or updated file content, must be base64 encoded
Content string `json:"content"`
- // sha is the SHA for the file that already exists, required for update, delete
+ // sha is the SHA for the file that already exists, required for update or delete
SHA string `json:"sha"`
// old path of the file to move
FromPath string `json:"from_path"`
@@ -85,7 +85,9 @@ type ChangeFileOperation struct {
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
type ChangeFilesOptions struct {
FileOptions
- Files []*ChangeFileOperation `json:"files"`
+ // list of file operations
+ // required: true
+ Files []*ChangeFileOperation `json:"files" binding:"Required"`
}
// Branch returns branch name