diff options
author | Richard Mahn <richmahn@users.noreply.github.com> | 2019-06-29 16:51:10 -0400 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-06-29 16:51:10 -0400 |
commit | cd96dee9822c8b744526ba862fd8b5ec0e2c30ff (patch) | |
tree | d7bbf2f2b7adf80b17f3ab3971ae49bae7b010c4 /templates | |
parent | 738285a4aac5df2e60f4038aa79be3e9fe921bdb (diff) | |
download | gitea-cd96dee9822c8b744526ba862fd8b5ec0e2c30ff.tar.gz gitea-cd96dee9822c8b744526ba862fd8b5ec0e2c30ff.zip |
Fixes #7292 - API File Contents bug (#7301)
Diffstat (limited to 'templates')
-rw-r--r-- | templates/swagger/v1_json.tmpl | 191 |
1 files changed, 130 insertions, 61 deletions
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 6c2708dd96..d6d501ed22 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -1570,6 +1570,45 @@ } } }, + "/repos/{owner}/{repo}/contents": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets the metadata of all the entries of the root dir", + "operationId": "repoGetContentsList", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag. Default the repository’s default branch (usually master)", + "name": "ref", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/ContentsListResponse" + } + } + } + }, "/repos/{owner}/{repo}/contents/{filepath}": { "get": { "produces": [ @@ -1578,8 +1617,8 @@ "tags": [ "repository" ], - "summary": "Gets the contents of a file or directory in a repository", - "operationId": "repoGetFileContents", + "summary": "Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir", + "operationId": "repoGetContents", "parameters": [ { "type": "string", @@ -1597,7 +1636,7 @@ }, { "type": "string", - "description": "path of the file to delete", + "description": "path of the dir, file, symlink or submodule in the repo", "name": "filepath", "in": "path", "required": true @@ -1611,7 +1650,7 @@ ], "responses": { "200": { - "$ref": "#/responses/FileContentResponse" + "$ref": "#/responses/ContentsResponse" } } }, @@ -7017,6 +7056,74 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ContentsResponse": { + "description": "ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content", + "type": "object", + "properties": { + "_links": { + "$ref": "#/definitions/FileLinksResponse" + }, + "content": { + "description": "`content` is populated when `type` is `file`, otherwise null", + "type": "string", + "x-go-name": "Content" + }, + "download_url": { + "type": "string", + "x-go-name": "DownloadURL" + }, + "encoding": { + "description": "`encoding` is populated when `type` is `file`, otherwise null", + "type": "string", + "x-go-name": "Encoding" + }, + "git_url": { + "type": "string", + "x-go-name": "GitURL" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "path": { + "type": "string", + "x-go-name": "Path" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "size": { + "type": "integer", + "format": "int64", + "x-go-name": "Size" + }, + "submodule_git_url": { + "description": "`submodule_git_url` is populated when `type` is `submodule`, otherwise null", + "type": "string", + "x-go-name": "SubmoduleGitURL" + }, + "target": { + "description": "`target` is populated when `type` is `symlink`, otherwise null", + "type": "string", + "x-go-name": "Target" + }, + "type": { + "description": "`type` will be `file`, `dir`, `symlink`, or `submodule`", + "type": "string", + "x-go-name": "Type" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "CreateEmailOption": { "description": "CreateEmailOption options when creating email addresses", "type": "object", @@ -8179,53 +8286,6 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, - "FileContentResponse": { - "description": "FileContentResponse contains information about a repo's file stats and content", - "type": "object", - "properties": { - "_links": { - "$ref": "#/definitions/FileLinksResponse" - }, - "download_url": { - "type": "string", - "x-go-name": "DownloadURL" - }, - "git_url": { - "type": "string", - "x-go-name": "GitURL" - }, - "html_url": { - "type": "string", - "x-go-name": "HTMLURL" - }, - "name": { - "type": "string", - "x-go-name": "Name" - }, - "path": { - "type": "string", - "x-go-name": "Path" - }, - "sha": { - "type": "string", - "x-go-name": "SHA" - }, - "size": { - "type": "integer", - "format": "int64", - "x-go-name": "Size" - }, - "type": { - "type": "string", - "x-go-name": "Type" - }, - "url": { - "type": "string", - "x-go-name": "URL" - } - }, - "x-go-package": "code.gitea.io/gitea/modules/structs" - }, "FileDeleteResponse": { "description": "FileDeleteResponse contains information about a repo's file that was deleted", "type": "object", @@ -8247,15 +8307,15 @@ "description": "FileLinksResponse contains the links for a repo's file", "type": "object", "properties": { - "git_url": { + "git": { "type": "string", "x-go-name": "GitURL" }, - "html_url": { + "html": { "type": "string", "x-go-name": "HTMLURL" }, - "url": { + "self": { "type": "string", "x-go-name": "Self" } @@ -8270,7 +8330,7 @@ "$ref": "#/definitions/FileCommitResponse" }, "content": { - "$ref": "#/definitions/FileContentResponse" + "$ref": "#/definitions/ContentsResponse" }, "verification": { "$ref": "#/definitions/PayloadCommitVerification" @@ -9898,6 +9958,21 @@ "$ref": "#/definitions/Commit" } }, + "ContentsListResponse": { + "description": "ContentsListResponse", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ContentsResponse" + } + } + }, + "ContentsResponse": { + "description": "ContentsResponse", + "schema": { + "$ref": "#/definitions/ContentsResponse" + } + }, "DeployKey": { "description": "DeployKey", "schema": { @@ -9922,12 +9997,6 @@ } } }, - "FileContentResponse": { - "description": "FileContentResponse", - "schema": { - "$ref": "#/definitions/FileContentResponse" - } - }, "FileDeleteResponse": { "description": "FileDeleteResponse", "schema": { |