Skip to content

Commit bae87df

Browse files
AdamMajerGiteaBot
andauthored
Add return type to GetRawFileOrLFS and GetRawFile (#31680)
Document return type for the endpoints that fetch specific files from a repository. This allows the swagger generated code to read the returned data. Co-authored-by: Giteabot <[email protected]>
1 parent cc04481 commit bae87df

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

routers/api/v1/repo/file.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func GetRawFile(ctx *context.APIContext) {
4242
// ---
4343
// summary: Get a file from a repository
4444
// produces:
45-
// - application/json
45+
// - application/octet-stream
4646
// parameters:
4747
// - name: owner
4848
// in: path
@@ -67,6 +67,8 @@ func GetRawFile(ctx *context.APIContext) {
6767
// responses:
6868
// 200:
6969
// description: Returns raw file content.
70+
// schema:
71+
// type: file
7072
// "404":
7173
// "$ref": "#/responses/notFound"
7274

@@ -92,6 +94,8 @@ func GetRawFileOrLFS(ctx *context.APIContext) {
9294
// swagger:operation GET /repos/{owner}/{repo}/media/{filepath} repository repoGetRawFileOrLFS
9395
// ---
9496
// summary: Get a file or it's LFS object from a repository
97+
// produces:
98+
// - application/octet-stream
9599
// parameters:
96100
// - name: owner
97101
// in: path
@@ -116,6 +120,8 @@ func GetRawFileOrLFS(ctx *context.APIContext) {
116120
// responses:
117121
// 200:
118122
// description: Returns raw file content.
123+
// schema:
124+
// type: file
119125
// "404":
120126
// "$ref": "#/responses/notFound"
121127

templates/swagger/v1_json.tmpl

+12-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)