mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-10 05:24:18 +09:00
refactor: serve the api specs as plain json (#38715)
The api specs were Go templates whose committed form was not a valid swagger document, so `swagger-validate`, `generate-openapi.go` and `.spectral.yaml` each worked around it. They are now plain json, substituted at serve time. Renaming them off `.tmpl` also stops `make fmt` rewriting them, which used to bump their mtime and silently skip the next `make generate-swagger`. Also enables stricter spectral linting: extends `lint-swagger` to the OpenAPI 3 spec, turns on `openapi-tags`, `operation-singular-tag` and `operation-tag-defined`, adds a top-level `tags` array with descriptions to the swagger input, and drops the redundant `repository` tag from `POST /user/repos`. --------- Signed-off-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
co-authored by
wxiaoguang
Giteabot
parent
a3e7fe1f11
commit
f0a95eebe3
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"info": {
|
||||
"version": "0.0.0+GITEA-API-APP-VERSION"
|
||||
},
|
||||
"basePath": "/GITEA-API-APP-SUBURL/api/v1",
|
||||
"tags": [
|
||||
{"name": "admin", "description": "Site administration"},
|
||||
{"name": "issue", "description": "Issues, pull requests, comments, labels and milestones"},
|
||||
{"name": "miscellaneous", "description": "Miscellaneous endpoints"},
|
||||
{"name": "notification", "description": "User notifications"},
|
||||
{"name": "organization", "description": "Organizations and teams"},
|
||||
{"name": "package", "description": "Package registry"},
|
||||
{"name": "repository", "description": "Repositories and their contents"},
|
||||
{"name": "settings", "description": "Server settings"},
|
||||
{"name": "user", "description": "The authenticated user"}
|
||||
]
|
||||
}
|
||||
+40
-3
@@ -10733,7 +10733,7 @@
|
||||
"url": "http://opensource.org/licenses/MIT"
|
||||
},
|
||||
"title": "Gitea API",
|
||||
"version": "{{.SwaggerAppVer}}"
|
||||
"version": "0.0.0+GITEA-API-APP-VERSION"
|
||||
},
|
||||
"openapi": "3.0.3",
|
||||
"paths": {
|
||||
@@ -33073,7 +33073,6 @@
|
||||
},
|
||||
"summary": "Create a repository",
|
||||
"tags": [
|
||||
"repository",
|
||||
"user"
|
||||
]
|
||||
}
|
||||
@@ -34201,7 +34200,45 @@
|
||||
],
|
||||
"servers": [
|
||||
{
|
||||
"url": "{{.SwaggerAppSubUrl}}/api/v1"
|
||||
"url": "/GITEA-API-APP-SUBURL/api/v1"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"description": "Site administration",
|
||||
"name": "admin"
|
||||
},
|
||||
{
|
||||
"description": "Issues, pull requests, comments, labels and milestones",
|
||||
"name": "issue"
|
||||
},
|
||||
{
|
||||
"description": "Miscellaneous endpoints",
|
||||
"name": "miscellaneous"
|
||||
},
|
||||
{
|
||||
"description": "User notifications",
|
||||
"name": "notification"
|
||||
},
|
||||
{
|
||||
"description": "Organizations and teams",
|
||||
"name": "organization"
|
||||
},
|
||||
{
|
||||
"description": "Package registry",
|
||||
"name": "package"
|
||||
},
|
||||
{
|
||||
"description": "Repositories and their contents",
|
||||
"name": "repository"
|
||||
},
|
||||
{
|
||||
"description": "Server settings",
|
||||
"name": "settings"
|
||||
},
|
||||
{
|
||||
"description": "The authenticated user",
|
||||
"name": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
+40
-3
@@ -17,9 +17,9 @@
|
||||
"name": "MIT",
|
||||
"url": "http://opensource.org/licenses/MIT"
|
||||
},
|
||||
"version": "{{.SwaggerAppVer}}"
|
||||
"version": "0.0.0+GITEA-API-APP-VERSION"
|
||||
},
|
||||
"basePath": "{{.SwaggerAppSubUrl}}/api/v1",
|
||||
"basePath": "/GITEA-API-APP-SUBURL/api/v1",
|
||||
"paths": {
|
||||
"/admin/actions/jobs": {
|
||||
"get": {
|
||||
@@ -20912,7 +20912,6 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository",
|
||||
"user"
|
||||
],
|
||||
"summary": "Create a repository",
|
||||
@@ -32087,5 +32086,43 @@
|
||||
{
|
||||
"TOTPHeader": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"description": "Site administration",
|
||||
"name": "admin"
|
||||
},
|
||||
{
|
||||
"description": "Issues, pull requests, comments, labels and milestones",
|
||||
"name": "issue"
|
||||
},
|
||||
{
|
||||
"description": "Miscellaneous endpoints",
|
||||
"name": "miscellaneous"
|
||||
},
|
||||
{
|
||||
"description": "User notifications",
|
||||
"name": "notification"
|
||||
},
|
||||
{
|
||||
"description": "Organizations and teams",
|
||||
"name": "organization"
|
||||
},
|
||||
{
|
||||
"description": "Package registry",
|
||||
"name": "package"
|
||||
},
|
||||
{
|
||||
"description": "Repositories and their contents",
|
||||
"name": "repository"
|
||||
},
|
||||
{
|
||||
"description": "Server settings",
|
||||
"name": "settings"
|
||||
},
|
||||
{
|
||||
"description": "The authenticated user",
|
||||
"name": "user"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"info": {
|
||||
"version": "{{.SwaggerAppVer}}"
|
||||
},
|
||||
"basePath": "{{.SwaggerAppSubUrl}}/api/v1"
|
||||
}
|
||||
Reference in New Issue
Block a user