Fixes #7292 - API File Contents bug (#7301)

This commit is contained in:
Richard Mahn 2019-06-29 16:51:10 -04:00 committed by techknowlogick
parent 738285a4aa
commit cd96dee982
17 changed files with 963 additions and 335 deletions

View file

@ -1570,7 +1570,7 @@
}
}
},
"/repos/{owner}/{repo}/contents/{filepath}": {
"/repos/{owner}/{repo}/contents": {
"get": {
"produces": [
"application/json"
@ -1578,8 +1578,8 @@
"tags": [
"repository"
],
"summary": "Gets the contents of a file or directory in a repository",
"operationId": "repoGetFileContents",
"summary": "Gets the metadata of all the entries of the root dir",
"operationId": "repoGetContentsList",
"parameters": [
{
"type": "string",
@ -1597,7 +1597,46 @@
},
{
"type": "string",
"description": "path of the file to delete",
"description": "The name of the commit/branch/tag. Default the repositorys default branch (usually master)",
"name": "ref",
"in": "query"
}
],
"responses": {
"200": {
"$ref": "#/responses/ContentsListResponse"
}
}
}
},
"/repos/{owner}/{repo}/contents/{filepath}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"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",
"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": "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": {