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 <teabot@gitea.io>
This commit is contained in:
Adam Majer 2024-07-25 14:06:19 +02:00 committed by GitHub
parent cc044818c3
commit bae87dfb09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 4 deletions

View File

@ -42,7 +42,7 @@ func GetRawFile(ctx *context.APIContext) {
// --- // ---
// summary: Get a file from a repository // summary: Get a file from a repository
// produces: // produces:
// - application/json // - application/octet-stream
// parameters: // parameters:
// - name: owner // - name: owner
// in: path // in: path
@ -67,6 +67,8 @@ func GetRawFile(ctx *context.APIContext) {
// responses: // responses:
// 200: // 200:
// description: Returns raw file content. // description: Returns raw file content.
// schema:
// type: file
// "404": // "404":
// "$ref": "#/responses/notFound" // "$ref": "#/responses/notFound"
@ -92,6 +94,8 @@ func GetRawFileOrLFS(ctx *context.APIContext) {
// swagger:operation GET /repos/{owner}/{repo}/media/{filepath} repository repoGetRawFileOrLFS // swagger:operation GET /repos/{owner}/{repo}/media/{filepath} repository repoGetRawFileOrLFS
// --- // ---
// summary: Get a file or it's LFS object from a repository // summary: Get a file or it's LFS object from a repository
// produces:
// - application/octet-stream
// parameters: // parameters:
// - name: owner // - name: owner
// in: path // in: path
@ -116,6 +120,8 @@ func GetRawFileOrLFS(ctx *context.APIContext) {
// responses: // responses:
// 200: // 200:
// description: Returns raw file content. // description: Returns raw file content.
// schema:
// type: file
// "404": // "404":
// "$ref": "#/responses/notFound" // "$ref": "#/responses/notFound"

View File

@ -10609,6 +10609,9 @@
}, },
"/repos/{owner}/{repo}/media/{filepath}": { "/repos/{owner}/{repo}/media/{filepath}": {
"get": { "get": {
"produces": [
"application/octet-stream"
],
"tags": [ "tags": [
"repository" "repository"
], ],
@ -10645,7 +10648,10 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Returns raw file content." "description": "Returns raw file content.",
"schema": {
"type": "file"
}
}, },
"404": { "404": {
"$ref": "#/responses/notFound" "$ref": "#/responses/notFound"
@ -12682,7 +12688,7 @@
"/repos/{owner}/{repo}/raw/{filepath}": { "/repos/{owner}/{repo}/raw/{filepath}": {
"get": { "get": {
"produces": [ "produces": [
"application/json" "application/octet-stream"
], ],
"tags": [ "tags": [
"repository" "repository"
@ -12720,7 +12726,10 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Returns raw file content." "description": "Returns raw file content.",
"schema": {
"type": "file"
}
}, },
"404": { "404": {
"$ref": "#/responses/notFound" "$ref": "#/responses/notFound"