Skip to content

Commit d4fc683

Browse files
committed
raw file api: clarify documentation
the ?ref= param was added recently in #14602, and can fully replace the (previously undocumented) ref-prefix of the filepath
1 parent 2e128ba commit d4fc683

File tree

2 files changed

+85
-2
lines changed

2 files changed

+85
-2
lines changed

routers/api/v1/repo/file.go

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,39 @@ import (
2323

2424
// GetRawFile get a file by path on a repository
2525
func GetRawFile(ctx *context.APIContext) {
26+
// swagger:operation GET /repos/{owner}/{repo}/raw/{ref}/{filepath} repository repoGetRawFileOld
27+
// ---
28+
// summary: Get a file from a repository
29+
// deprecated: true
30+
// produces:
31+
// - application/json
32+
// parameters:
33+
// - name: owner
34+
// in: path
35+
// description: owner of the repo
36+
// type: string
37+
// required: true
38+
// - name: repo
39+
// in: path
40+
// description: name of the repo
41+
// type: string
42+
// required: true
43+
// - name: filepath
44+
// in: path
45+
// description: filepath of the file to get
46+
// type: string
47+
// required: true
48+
// - name: ref
49+
// in: path
50+
// description: "The name of the commit/branch/tag. Default to the repository’s default branch (usually master)"
51+
// type: string
52+
// deprecated: true
53+
// responses:
54+
// 200:
55+
// description: success
56+
// "404":
57+
// "$ref": "#/responses/notFound"
58+
2659
// swagger:operation GET /repos/{owner}/{repo}/raw/{filepath} repository repoGetRawFile
2760
// ---
2861
// summary: Get a file from a repository
@@ -46,7 +79,7 @@ func GetRawFile(ctx *context.APIContext) {
4679
// required: true
4780
// - name: ref
4881
// in: query
49-
// description: "The name of the commit/branch/tag. Default the repository’s default branch (usually master)"
82+
// description: "The name of the commit/branch/tag. Default to the repository’s default branch (usually master)"
5083
// type: string
5184
// required: false
5285
// responses:

templates/swagger/v1_json.tmpl

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8214,7 +8214,7 @@
82148214
},
82158215
{
82168216
"type": "string",
8217-
"description": "The name of the commit/branch/tag. Default the repository’s default branch (usually master)",
8217+
"description": "The name of the commit/branch/tag. Default to the repository’s default branch (usually master)",
82188218
"name": "ref",
82198219
"in": "query"
82208220
}
@@ -8229,6 +8229,56 @@
82298229
}
82308230
}
82318231
},
8232+
"/repos/{owner}/{repo}/raw/{ref}/{filepath}": {
8233+
"get": {
8234+
"produces": [
8235+
"application/json"
8236+
],
8237+
"tags": [
8238+
"repository"
8239+
],
8240+
"summary": "Get a file from a repository",
8241+
"operationId": "repoGetRawFileOld",
8242+
"deprecated": true,
8243+
"parameters": [
8244+
{
8245+
"type": "string",
8246+
"description": "owner of the repo",
8247+
"name": "owner",
8248+
"in": "path",
8249+
"required": true
8250+
},
8251+
{
8252+
"type": "string",
8253+
"description": "name of the repo",
8254+
"name": "repo",
8255+
"in": "path",
8256+
"required": true
8257+
},
8258+
{
8259+
"type": "string",
8260+
"description": "filepath of the file to get",
8261+
"name": "filepath",
8262+
"in": "path",
8263+
"required": true
8264+
},
8265+
{
8266+
"type": "string",
8267+
"description": "The name of the commit/branch/tag. Default to the repository’s default branch (usually master)",
8268+
"name": "ref",
8269+
"in": "path"
8270+
}
8271+
],
8272+
"responses": {
8273+
"200": {
8274+
"description": "success"
8275+
},
8276+
"404": {
8277+
"$ref": "#/responses/notFound"
8278+
}
8279+
}
8280+
}
8281+
},
82328282
"/repos/{owner}/{repo}/releases": {
82338283
"get": {
82348284
"produces": [

0 commit comments

Comments
 (0)